_navbar.scss 3.8 KB
Newer Older
Mark Otto's avatar
Mark Otto committed
1
2
3
4
5
6
7
// Wrapper and base class
//
// Provide a static navbar from which we expand to create full-width, fixed, and
// other navbar variations.

.navbar {
  position: relative;
8
  padding: $navbar-padding-vertical $navbar-padding-horizontal;
9
  @include clearfix;
Mark Otto's avatar
Mark Otto committed
10

11
  @include media-breakpoint-up(sm) {
Mark Otto's avatar
Mark Otto committed
12
13
14
15
16
17
18
19
20
21
22
23
24
25
    @include border-radius($navbar-border-radius);
  }
}


// Navbar alignment options
//
// Display the navbar across the entirety of the page or fixed it to the top or
// bottom of the page.

// Static top (unfixed, but 100% wide) navbar
.navbar-static-top {
  z-index: $zindex-navbar;

26
  @include media-breakpoint-up(sm) {
Mark Otto's avatar
Mark Otto committed
27
28
29
30
31
32
33
34
35
36
37
38
39
    @include border-radius(0);
  }
}

// Fix the top/bottom navbars when screen real estate supports it
.navbar-fixed-top,
.navbar-fixed-bottom {
  position: fixed;
  right: 0;
  left: 0;
  z-index: $zindex-navbar-fixed;

  // Undo the rounded corners
40
  @include media-breakpoint-up(sm) {
Mark Otto's avatar
Mark Otto committed
41
42
43
    @include border-radius(0);
  }
}
44

Mark Otto's avatar
Mark Otto committed
45
46
47
.navbar-fixed-top {
  top: 0;
}
48

Mark Otto's avatar
Mark Otto committed
49
50
51
52
.navbar-fixed-bottom {
  bottom: 0;
}

Mark Otto's avatar
Mark Otto committed
53
54
55
56
.navbar-sticky-top {
  position: sticky;
  top: 0;
  z-index: $zindex-navbar-sticky;
57
  width: 100%;
Mark Otto's avatar
Mark Otto committed
58
59
60
61
62
63
64

  // Undo the rounded corners
  @include media-breakpoint-up(sm) {
    @include border-radius(0);
  }
}

Mark Otto's avatar
Mark Otto committed
65

Mark Otto's avatar
Mark Otto committed
66
//
Mark Otto's avatar
Mark Otto committed
67
// Brand/project name
Mark Otto's avatar
Mark Otto committed
68
//
Mark Otto's avatar
Mark Otto committed
69
70
71

.navbar-brand {
  float: left;
72
73
74
  margin-right: 1rem;
  padding-top:    .25rem;
  padding-bottom: .25rem;
Mark Otto's avatar
Mark Otto committed
75
76
  font-size: $font-size-lg;

Mark Otto's avatar
Mark Otto committed
77
78
  @include hover-focus {
    text-decoration: none;
Mark Otto's avatar
Mark Otto committed
79
80
81
82
83
84
85
86
  }

  > img {
    display: block;
  }
}


Mark Otto's avatar
Mark Otto committed
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
.navbar-divider {
  float: left;
  width: 1px;
  padding-top: .425rem;
  padding-bottom: .425rem;
  overflow: hidden;
  margin-left:  $navbar-padding-horizontal;
  margin-right: $navbar-padding-horizontal;

  &:before {
    content: '\00a0';
  }
}


Mark Otto's avatar
Mark Otto committed
102
103
104
// Navbar toggle
//
// Custom button for toggling the `.navbar-collapse`, powered by the collapse
Mark Otto's avatar
comment    
Mark Otto committed
105
// Bootstrap JavaScript plugin.
Mark Otto's avatar
Mark Otto committed
106
107

.navbar-toggler {
Mark Otto's avatar
Mark Otto committed
108
  padding: .5rem .75rem;
Mark Otto's avatar
Mark Otto committed
109
  font-size: $font-size-lg;
Mark Otto's avatar
Mark Otto committed
110
  line-height: 1;
Mark Otto's avatar
Mark Otto committed
111
  background: none;
Mark Otto's avatar
Mark Otto committed
112
113
  border: $border-width solid transparent;
  @include border-radius($btn-border-radius);
Mark Otto's avatar
Mark Otto committed
114

115
  @include hover-focus {
Mark Otto's avatar
Mark Otto committed
116
117
118
119
    text-decoration: none;
  }
}

Mark Otto's avatar
Mark Otto committed
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// Custom override for
.navbar-toggleable {
  &-xs {
    @include media-breakpoint-up(sm) {
      display: block !important;
    }
  }
  &-sm {
    @include media-breakpoint-up(md) {
      display: block !important;
    }
  }
}

Mark Otto's avatar
Mark Otto committed
134

Mark Otto's avatar
Mark Otto committed
135
// Navigation
136
//
Mark Otto's avatar
Mark Otto committed
137
// Custom navbar navigation built on the base `.nav` styles.
138
139
140
141
142
143
144
145

.navbar-nav {
  .nav-item {
    float: left;
  }

  .nav-link {
    display: block;
Mark Otto's avatar
Mark Otto committed
146
147
148
149
150
151
152
153
154
155
    padding-top:    .425rem;
    padding-bottom: .425rem;

    + .nav-link {
      margin-left: 1rem;
    }
  }

  .nav-item + .nav-item {
    margin-left: 1rem;
Mark Otto's avatar
Mark Otto committed
156
157
158
  }
}

159
160
// Dark links against a light background
.navbar-light {
Mark Otto's avatar
Mark Otto committed
161
  .navbar-brand {
162
    color: $navbar-light-active-color;
Chris Rebert's avatar
Chris Rebert committed
163

164
    @include hover-focus {
165
      color: $navbar-light-active-color;
Mark Otto's avatar
Mark Otto committed
166
167
168
    }
  }

169
170
171
  .navbar-nav {
    .nav-link {
      color: $navbar-light-color;
Mark Otto's avatar
Mark Otto committed
172

173
174
175
176
      @include hover-focus {
        color: $navbar-light-hover-color;
      }
    }
Mark Otto's avatar
Mark Otto committed
177

178
179
180
181
182
183
184
185
186
    .open > .nav-link,
    .active > .nav-link,
    .nav-link.open,
    .nav-link.active {
      @include plain-hover-focus {
        color: $navbar-light-active-color;
      }
    }
  }
Mark Otto's avatar
Mark Otto committed
187
188
189
190

  .navbar-divider {
    background-color: rgba(0,0,0,.075);
  }
191
192
193
194
}

// White links against a dark background
.navbar-dark {
Mark Otto's avatar
Mark Otto committed
195
  .navbar-brand {
196
    color: $navbar-dark-active-color;
Mark Otto's avatar
Mark Otto committed
197

198
    @include hover-focus {
199
      color: $navbar-dark-active-color;
Mark Otto's avatar
Mark Otto committed
200
201
202
203
    }
  }

  .navbar-nav {
Mark Otto's avatar
Mark Otto committed
204
    .nav-link {
205
      color: $navbar-dark-color;
Mark Otto's avatar
Mark Otto committed
206

207
      @include hover-focus {
208
        color: $navbar-dark-hover-color;
Mark Otto's avatar
Mark Otto committed
209
      }
Mark Otto's avatar
Mark Otto committed
210
    }
Mark Otto's avatar
Mark Otto committed
211

Mark Otto's avatar
Mark Otto committed
212
213
214
215
216
    .open > .nav-link,
    .active > .nav-link,
    .nav-link.open,
    .nav-link.active {
      @include plain-hover-focus {
217
        color: $navbar-dark-active-color;
218
      }
Mark Otto's avatar
Mark Otto committed
219
220
    }
  }
Mark Otto's avatar
Mark Otto committed
221
222
223
224

  .navbar-divider {
    background-color: rgba(255,255,255,.075);
  }
Mark Otto's avatar
Mark Otto committed
225
}