0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-10 22:24:19 +01:00
Bootstrap/scss/_nav.scss

178 lines
3.4 KiB
SCSS
Raw Normal View History

// Base class
2012-06-29 06:46:45 +02:00
//
// Kickstart any navigation component with a set of style resets. Works with
// `<nav>`s or `<ul>`s.
2014-07-09 22:51:49 +02:00
.nav {
padding-left: 0;
2014-07-14 08:33:54 +02:00
margin-bottom: 0;
list-style: none;
2014-07-09 22:51:49 +02:00
}
.nav-link {
display: inline-block;
2014-07-09 22:51:49 +02:00
@include hover-focus {
2014-07-09 22:51:49 +02:00
text-decoration: none;
}
// Disabled state lightens text and removes hover/tab effects
&.disabled {
2014-12-02 23:02:35 +01:00
color: $nav-disabled-link-color;
2014-07-09 22:51:49 +02:00
@include plain-hover-focus {
2014-12-02 23:02:35 +01:00
color: $nav-disabled-link-hover-color;
cursor: $cursor-disabled;
background-color: $nav-disabled-link-hover-bg;
2014-07-09 22:51:49 +02:00
}
}
}
// Nav inline
.nav-inline {
.nav-item {
display: inline-block;
}
.nav-item + .nav-item,
.nav-link + .nav-link {
margin-left: $nav-item-inline-spacer;
}
}
//
2012-11-04 00:14:44 +01:00
// Tabs
//
.nav-tabs {
border-bottom: $nav-tabs-border-width solid $nav-tabs-border-color;
@include clearfix();
.nav-item {
2013-04-16 16:45:51 +02:00
float: left;
// Make the list-items overlay the bottom border
margin-bottom: -$nav-tabs-border-width;
2013-04-16 16:45:51 +02:00
+ .nav-item {
margin-left: $nav-item-margin;
2013-04-16 16:45:51 +02:00
}
}
.nav-link {
display: block;
padding: $nav-link-padding;
border: $nav-tabs-border-width solid transparent;
@include border-top-radius($nav-tabs-border-radius);
2013-04-16 16:45:51 +02:00
@include hover-focus {
2014-12-02 23:02:35 +01:00
border-color: $nav-tabs-link-hover-border-color $nav-tabs-link-hover-border-color $nav-tabs-border-color;
2013-04-16 16:45:51 +02:00
}
&.disabled {
@include plain-hover-focus {
color: $nav-disabled-link-color;
background-color: transparent;
border-color: transparent;
}
}
}
2013-04-16 16:45:51 +02:00
.nav-link.active,
.nav-item.open .nav-link {
@include plain-hover-focus {
2014-12-02 23:02:35 +01:00
color: $nav-tabs-active-link-hover-color;
background-color: $nav-tabs-active-link-hover-bg;
border-color: $nav-tabs-active-link-hover-border-color $nav-tabs-active-link-hover-border-color transparent;
2013-04-16 16:45:51 +02:00
}
}
.dropdown-menu {
// Make dropdown border overlap tab border
margin-top: -$nav-tabs-border-width;
// Remove the top rounded corners here since there is a hard edge above the menu
@include border-top-radius(0);
}
}
//
// Pills
//
.nav-pills {
@include clearfix();
.nav-item {
float: left;
+ .nav-item {
margin-left: $nav-item-margin;
}
}
.nav-link {
display: block;
padding: $nav-link-padding;
2014-12-02 23:02:35 +01:00
@include border-radius($nav-pills-border-radius);
}
.nav-link.active,
.nav-item.open .nav-link {
@include plain-hover-focus {
color: $nav-pills-active-link-color;
cursor: default;
background-color: $nav-pills-active-link-bg;
}
}
}
.nav-stacked {
.nav-item {
display: block;
float: none;
+ .nav-item {
margin-top: $nav-item-margin;
margin-left: 0;
}
}
}
//
// Tabbable tabs
//
// Hide tabbable panes to start, show them when `.active`
.tab-content {
> .tab-pane {
display: none;
}
2013-07-07 06:51:47 +02:00
> .active {
display: block;
}
}
2016-12-22 05:26:17 +01:00
// Justified navigation
//
// Justified nav components are only built for flexbox mode in Bootstrap 4. In
// previous versions, this component variation was limited to anchor-based nav
// implementations--meaning it couldn't be used on button elements. This is due
// to a longstanding Safari bug in responsive table styles.
//
// Using flexbox, we avoid that problem altogether at the cost of no default
// justified navigation for default Bootstrap. Sorry, y'all <3.
2016-12-22 05:26:17 +01:00
.nav-justified {
display: flex;
2016-12-22 05:26:17 +01:00
.nav-item {
flex: 1;
text-align: center;
}
}