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