0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-10 22:24:19 +01:00
Bootstrap/scss/_navbar.scss
2015-08-17 23:43:59 -07:00

230 lines
4.2 KiB
SCSS

// Wrapper and base class
//
// Provide a static navbar from which we expand to create full-width, fixed, and
// other navbar variations.
.navbar {
position: relative;
@include clearfix;
@include media-breakpoint-up(sm) {
@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;
@include media-breakpoint-up(sm) {
@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;
margin-bottom: 0; // override .navbar defaults
// Undo the rounded corners
@include media-breakpoint-up(sm) {
@include border-radius(0);
}
}
.navbar-fixed-top {
top: 0;
}
.navbar-fixed-bottom {
bottom: 0;
}
.navbar-sticky-top {
position: sticky;
top: 0;
z-index: $zindex-navbar-sticky;
width: 100%;
// Undo the rounded corners
@include media-breakpoint-up(sm) {
@include border-radius(0);
}
}
//
// Brand/project name
//
.navbar-brand {
float: left;
padding: .95rem 1rem;
font-size: $font-size-lg;
line-height: 1;
color: $navbar-default-brand-color;
@include hover-focus {
color: $navbar-default-brand-hover-color;
text-decoration: none;
}
> img {
display: block;
}
}
// Navbar toggle
//
// Custom button for toggling the `.navbar-collapse`, powered by the collapse
// Bootstrap JavaScript plugin.
.navbar-toggler {
padding: .5rem .75rem;
margin-top: .375rem;
margin-bottom: .375rem;
font-size: $font-size-lg;
line-height: 1;
color: $navbar-default-link-color;
background: none;
border: $border-width solid transparent;
@include border-radius($btn-border-radius);
@include hover-focus {
text-decoration: none;
}
}
// Custom override for
.navbar-toggleable {
&-xs {
@include media-breakpoint-up(sm) {
display: block !important;
}
}
&-sm {
@include media-breakpoint-up(md) {
display: block !important;
}
}
}
// Navigation
//
// Custom navbar navigation built on the base `.nav` styles.
.navbar-nav {
.nav-item {
float: left;
}
.nav-link {
display: block;
padding: .95rem .75rem;
line-height: 1.25; // Match the `.navbar-brand`
color: $navbar-default-link-color;
@include hover-focus {
color: $navbar-default-link-hover-color;
background-color: $navbar-default-link-hover-bg;
}
}
.open > .nav-link,
.active > .nav-link,
.nav-link.open,
.nav-link.active {
@include plain-hover-focus {
color: $navbar-default-link-active-color;
cursor: default;
background-color: $navbar-default-link-active-bg;
}
}
}
// Forms
//
// Additional modifier class to add to `.form-inline` to vertically center forms.
.navbar-form {
margin-top: .375rem;
margin-bottom: .375rem;
margin-right: 1rem;
}
//
// Alternate navbars
//
// todo: audit these styles
// Default navbar
.navbar-default {
background-color: $navbar-default-bg;
border-color: $navbar-default-border;
.navbar-brand {
color: $navbar-default-brand-color;
@include hover-focus {
color: $navbar-default-brand-hover-color;
background-color: $navbar-default-brand-hover-bg;
}
}
}
// Inverse navbar
.navbar-inverse {
background-color: $navbar-inverse-bg;
border-color: $navbar-inverse-border;
.navbar-brand {
color: $navbar-inverse-brand-color;
@include hover-focus {
color: $navbar-inverse-brand-hover-color;
background-color: $navbar-inverse-brand-hover-bg;
}
}
.navbar-nav {
.nav-link {
color: $navbar-inverse-link-color;
@include hover-focus {
color: $navbar-inverse-link-hover-color;
background-color: $navbar-inverse-link-hover-bg;
}
}
.open > .nav-link,
.active > .nav-link,
.nav-link.open,
.nav-link.active {
@include plain-hover-focus {
color: $navbar-inverse-link-active-color;
background-color: $navbar-inverse-link-active-bg;
}
}
}
.navbar-toggler {
color: $navbar-inverse-link-color;
}
}