Layout von Websiten mit Bootstrap und Foundation
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 7.2KB

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