0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-01 13:24:25 +01:00
Bootstrap/scss/_navbar.scss

230 lines
4.2 KiB
SCSS
Raw Normal View History

2014-12-02 23:02:35 +01:00
// 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;
2014-12-02 23:02:35 +01:00
@include media-breakpoint-up(sm) {
2014-12-02 23:02:35 +01:00
@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) {
2014-12-02 23:02:35 +01:00
@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
2014-12-02 23:02:35 +01:00
// Undo the rounded corners
@include media-breakpoint-up(sm) {
2014-12-02 23:02:35 +01:00
@include border-radius(0);
}
}
2014-12-02 23:02:35 +01:00
.navbar-fixed-top {
top: 0;
}
2014-12-02 23:02:35 +01:00
.navbar-fixed-bottom {
bottom: 0;
}
2015-04-14 04:00:59 +02:00
.navbar-sticky-top {
position: sticky;
top: 0;
z-index: $zindex-navbar-sticky;
width: 100%;
2015-04-14 04:00:59 +02:00
// Undo the rounded corners
@include media-breakpoint-up(sm) {
@include border-radius(0);
}
}
2014-12-02 23:02:35 +01:00
2015-08-18 08:43:59 +02:00
//
2014-12-02 23:02:35 +01:00
// Brand/project name
2015-08-18 08:43:59 +02:00
//
2014-12-02 23:02:35 +01:00
.navbar-brand {
float: left;
2015-08-18 08:43:59 +02:00
padding: .95rem 1rem;
2014-12-02 23:02:35 +01:00
font-size: $font-size-lg;
line-height: 1;
2015-08-18 08:43:59 +02:00
color: $navbar-default-brand-color;
2014-12-02 23:02:35 +01:00
2015-08-18 08:43:59 +02:00
@include hover-focus {
color: $navbar-default-brand-hover-color;
text-decoration: none;
2014-12-02 23:02:35 +01:00
}
> img {
display: block;
}
}
// Navbar toggle
//
// Custom button for toggling the `.navbar-collapse`, powered by the collapse
2015-06-23 02:37:52 +02:00
// Bootstrap JavaScript plugin.
2014-12-02 23:02:35 +01:00
.navbar-toggler {
2015-08-18 08:43:59 +02:00
padding: .5rem .75rem;
margin-top: .375rem;
margin-bottom: .375rem;
2014-12-02 23:02:35 +01:00
font-size: $font-size-lg;
line-height: 1;
2015-08-18 08:43:59 +02:00
color: $navbar-default-link-color;
2014-12-02 23:02:35 +01:00
background: none;
2015-08-18 08:43:59 +02:00
border: $border-width solid transparent;
@include border-radius($btn-border-radius);
2014-12-02 23:02:35 +01:00
@include hover-focus {
2014-12-02 23:02:35 +01:00
text-decoration: none;
}
}
2015-04-17 03:50:32 +02:00
// Custom override for
.navbar-toggleable {
&-xs {
@include media-breakpoint-up(sm) {
display: block !important;
}
}
&-sm {
@include media-breakpoint-up(md) {
display: block !important;
}
}
}
2014-12-02 23:02:35 +01:00
2015-08-18 08:43:59 +02:00
// Navigation
//
2015-08-18 08:43:59 +02:00
// Custom navbar navigation built on the base `.nav` styles.
.navbar-nav {
.nav-item {
float: left;
}
.nav-link {
display: block;
2015-08-18 08:43:59 +02:00
padding: .95rem .75rem;
line-height: 1.25; // Match the `.navbar-brand`
2015-08-18 08:43:59 +02:00
color: $navbar-default-link-color;
@include hover-focus {
color: $navbar-default-link-hover-color;
background-color: $navbar-default-link-hover-bg;
}
2014-12-02 23:02:35 +01:00
}
.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;
2014-12-02 23:02:35 +01:00
}
}
}
2015-08-18 08:43:59 +02:00
// Forms
//
// Additional modifier class to add to `.form-inline` to vertically center forms.
.navbar-form {
margin-top: .375rem;
margin-bottom: .375rem;
margin-right: 1rem;
}
//
2014-12-02 23:02:35 +01:00
// Alternate navbars
2015-08-18 08:43:59 +02:00
//
2014-12-02 23:02:35 +01:00
// todo: audit these styles
2014-12-02 23:02:35 +01:00
// Default navbar
.navbar-default {
background-color: $navbar-default-bg;
border-color: $navbar-default-border;
.navbar-brand {
color: $navbar-default-brand-color;
2014-12-20 03:35:10 +01:00
@include hover-focus {
2014-12-02 23:02:35 +01:00
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;
2015-08-18 08:43:59 +02:00
@include hover-focus {
2014-12-02 23:02:35 +01:00
color: $navbar-inverse-brand-hover-color;
background-color: $navbar-inverse-brand-hover-bg;
}
}
.navbar-nav {
2015-08-18 08:43:59 +02:00
.nav-link {
2014-12-02 23:02:35 +01:00
color: $navbar-inverse-link-color;
@include hover-focus {
2014-12-02 23:02:35 +01:00
color: $navbar-inverse-link-hover-color;
background-color: $navbar-inverse-link-hover-bg;
}
2015-08-18 08:43:59 +02:00
}
2014-12-02 23:02:35 +01:00
2015-08-18 08:43:59 +02:00
.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;
}
2014-12-02 23:02:35 +01:00
}
}
2015-08-18 08:43:59 +02:00
.navbar-toggler {
color: $navbar-inverse-link-color;
}
2014-12-02 23:02:35 +01:00
}