No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_navbar.scss 6.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. // Contents
  2. //
  3. // Navbar
  4. // Navbar brand
  5. // Navbar nav
  6. // Navbar text
  7. // Navbar divider
  8. // Responsive navbar
  9. // Navbar position
  10. // Navbar themes
  11. // Navbar
  12. //
  13. // Provide a static navbar from which we expand to create full-width, fixed, and
  14. // other navbar variations.
  15. .navbar {
  16. position: relative;
  17. display: flex;
  18. flex-wrap: wrap; // allow us to do the line break for collapsing content
  19. align-items: center;
  20. justify-content: space-between; // space out brand from logo
  21. padding: $navbar-padding-y $navbar-padding-x;
  22. // Because flex properties aren't inherited, we need to redeclare these first
  23. // few properties so that content nested within behave properly.
  24. > .container,
  25. > .container-fluid {
  26. display: flex;
  27. flex-wrap: wrap;
  28. align-items: center;
  29. justify-content: space-between;
  30. }
  31. }
  32. // Navbar brand
  33. //
  34. // Used for brand, project, or site names.
  35. .navbar-brand {
  36. display: inline-block;
  37. padding-top: $navbar-brand-padding-y;
  38. padding-bottom: $navbar-brand-padding-y;
  39. margin-right: $navbar-padding-x;
  40. font-size: $navbar-brand-font-size;
  41. line-height: inherit;
  42. white-space: nowrap;
  43. @include hover-focus {
  44. text-decoration: none;
  45. }
  46. }
  47. // Navbar nav
  48. //
  49. // Custom navbar navigation (doesn't require `.nav`, but does make use of `.nav-link`).
  50. .navbar-nav {
  51. display: flex;
  52. flex-direction: column; // cannot use `inherit` to get the `.navbar`s value
  53. padding-left: 0;
  54. margin-bottom: 0;
  55. list-style: none;
  56. .nav-link {
  57. padding-right: 0;
  58. padding-left: 0;
  59. }
  60. .dropdown-menu {
  61. position: static;
  62. float: none;
  63. }
  64. }
  65. // Navbar text
  66. //
  67. //
  68. .navbar-text {
  69. display: inline-block;
  70. padding-top: $nav-link-padding-y;
  71. padding-bottom: $nav-link-padding-y;
  72. }
  73. // Responsive navbar
  74. //
  75. // Custom styles for responsive collapsing and toggling of navbar contents.
  76. // Powered by the collapse Bootstrap JavaScript plugin.
  77. // When collapsed, prevent the toggleable navbar contents from appearing in
  78. // the default flexbox row orientation. Requires the use of `flex-wrap: wrap`
  79. // on the `.navbar` parent.
  80. .navbar-collapse {
  81. flex-basis: 100%;
  82. flex-grow: 1;
  83. // For always expanded or extra full navbars, ensure content aligns itself
  84. // properly vertically. Can be easily overridden with flex utilities.
  85. align-items: center;
  86. }
  87. // Button for toggling the navbar when in its collapsed state
  88. .navbar-toggler {
  89. padding: $navbar-toggler-padding-y $navbar-toggler-padding-x;
  90. font-size: $navbar-toggler-font-size;
  91. line-height: 1;
  92. background-color: transparent; // remove default button style
  93. border: $border-width solid transparent; // remove default button style
  94. @include border-radius($navbar-toggler-border-radius);
  95. @include hover-focus {
  96. text-decoration: none;
  97. }
  98. // Opinionated: add "hand" cursor to non-disabled .navbar-toggler elements
  99. &:not(:disabled):not(.disabled) {
  100. cursor: pointer;
  101. }
  102. }
  103. // Keep as a separate element so folks can easily override it with another icon
  104. // or image file as needed.
  105. .navbar-toggler-icon {
  106. display: inline-block;
  107. width: 1.5em;
  108. height: 1.5em;
  109. vertical-align: middle;
  110. content: "";
  111. background: no-repeat center center;
  112. background-size: 100% 100%;
  113. }
  114. // Generate series of `.navbar-expand-*` responsive classes for configuring
  115. // where your navbar collapses.
  116. .navbar-expand {
  117. @each $breakpoint in map-keys($grid-breakpoints) {
  118. $next: breakpoint-next($breakpoint, $grid-breakpoints);
  119. $infix: breakpoint-infix($next, $grid-breakpoints);
  120. &#{$infix} {
  121. @include media-breakpoint-down($breakpoint) {
  122. > .container,
  123. > .container-fluid {
  124. padding-right: 0;
  125. padding-left: 0;
  126. }
  127. }
  128. @include media-breakpoint-up($next) {
  129. flex-flow: row nowrap;
  130. justify-content: flex-start;
  131. .navbar-nav {
  132. flex-direction: row;
  133. .dropdown-menu {
  134. position: absolute;
  135. }
  136. .nav-link {
  137. padding-right: $navbar-nav-link-padding-x;
  138. padding-left: $navbar-nav-link-padding-x;
  139. }
  140. }
  141. // For nesting containers, have to redeclare for alignment purposes
  142. > .container,
  143. > .container-fluid {
  144. flex-wrap: nowrap;
  145. }
  146. .navbar-collapse {
  147. display: flex !important; // stylelint-disable-line declaration-no-important
  148. // Changes flex-bases to auto because of an IE10 bug
  149. flex-basis: auto;
  150. }
  151. .navbar-toggler {
  152. display: none;
  153. }
  154. }
  155. }
  156. }
  157. }
  158. // Navbar themes
  159. //
  160. // Styles for switching between navbars with light or dark background.
  161. // Dark links against a light background
  162. .navbar-light {
  163. .navbar-brand {
  164. color: $navbar-light-active-color;
  165. @include hover-focus {
  166. color: $navbar-light-active-color;
  167. }
  168. }
  169. .navbar-nav {
  170. .nav-link {
  171. color: $navbar-light-color;
  172. @include hover-focus {
  173. color: $navbar-light-hover-color;
  174. }
  175. &.disabled {
  176. color: $navbar-light-disabled-color;
  177. }
  178. }
  179. .show > .nav-link,
  180. .active > .nav-link,
  181. .nav-link.show,
  182. .nav-link.active {
  183. color: $navbar-light-active-color;
  184. }
  185. }
  186. .navbar-toggler {
  187. color: $navbar-light-color;
  188. border-color: $navbar-light-toggler-border-color;
  189. }
  190. .navbar-toggler-icon {
  191. background-image: $navbar-light-toggler-icon-bg;
  192. }
  193. .navbar-text {
  194. color: $navbar-light-color;
  195. a {
  196. color: $navbar-light-active-color;
  197. @include hover-focus {
  198. color: $navbar-light-active-color;
  199. }
  200. }
  201. }
  202. }
  203. // White links against a dark background
  204. .navbar-dark {
  205. .navbar-brand {
  206. color: $navbar-dark-active-color;
  207. @include hover-focus {
  208. color: $navbar-dark-active-color;
  209. }
  210. }
  211. .navbar-nav {
  212. .nav-link {
  213. color: $navbar-dark-color;
  214. @include hover-focus {
  215. color: $navbar-dark-hover-color;
  216. }
  217. &.disabled {
  218. color: $navbar-dark-disabled-color;
  219. }
  220. }
  221. .show > .nav-link,
  222. .active > .nav-link,
  223. .nav-link.show,
  224. .nav-link.active {
  225. color: $navbar-dark-active-color;
  226. }
  227. }
  228. .navbar-toggler {
  229. color: $navbar-dark-color;
  230. border-color: $navbar-dark-toggler-border-color;
  231. }
  232. .navbar-toggler-icon {
  233. background-image: $navbar-dark-toggler-icon-bg;
  234. }
  235. .navbar-text {
  236. color: $navbar-dark-color;
  237. a {
  238. color: $navbar-dark-active-color;
  239. @include hover-focus {
  240. color: $navbar-dark-active-color;
  241. }
  242. }
  243. }
  244. }