twbs--bootstrap/less/navs.less

238 lines
4.7 KiB
Plaintext
Raw Normal View History

2012-06-29 04:46:45 +00:00
//
// Navs
// --------------------------------------------------
2012-11-03 23:14:44 +00:00
// Base class
// --------------------------------------------------
.nav {
margin-bottom: 0;
padding-left: 0; // Override default ul/ol
list-style: none;
&:extend(.clearfix all);
2013-04-16 14:45:51 +00:00
> li {
position: relative;
2013-04-16 14:45:51 +00:00
display: block;
2013-04-16 14:45:51 +00:00
> a {
position: relative;
display: block;
padding: @nav-link-padding;
2014-07-09 07:15:20 +00:00
line-height: @line-height-base;
2013-04-16 14:45:51 +00:00
&:hover,
&:focus {
text-decoration: none;
background-color: @nav-link-hover-bg;
2013-04-16 14:45:51 +00:00
}
}
// Disabled state sets text to gray and nukes hover/tab effects
2013-04-16 14:45:51 +00:00
&.disabled > a {
color: @nav-disabled-link-color;
2013-07-07 04:51:47 +00:00
&:hover,
&:focus {
color: @nav-disabled-link-hover-color;
2013-07-07 04:51:47 +00:00
text-decoration: none;
background-color: transparent;
cursor: not-allowed;
2013-07-07 04:51:47 +00:00
}
2013-04-16 14:45:51 +00:00
}
}
// Open dropdowns
.open > a {
2013-07-07 04:51:47 +00:00
&,
&:hover,
&:focus {
background-color: @nav-link-hover-bg;
2013-07-07 04:51:47 +00:00
border-color: @link-color;
}
2013-04-16 14:45:51 +00:00
}
// Nav dividers (deprecated with v3.0.1)
//
// This should have been removed in v3 with the dropping of `.nav-list`, but
// we missed it. We don't currently support this anywhere, but in the interest
// of maintaining backward compatibility in case you use it, it's deprecated.
.nav-divider {
2013-04-16 14:45:51 +00:00
.nav-divider();
}
}
2012-11-03 23:14:44 +00:00
// Tabs
// -------------------------
// Give the tabs something to sit on
.nav-tabs {
border-bottom: 1px solid @nav-tabs-border-color;
2013-04-16 14:45:51 +00:00
> li {
float: left;
// Make the list-items overlay the bottom border
margin-bottom: -1px;
2013-04-16 14:45:51 +00:00
// Actual tabs (as links)
> a {
margin-right: 2px;
line-height: @line-height-base;
border: 1px solid transparent;
.border-radius(@border-radius-base @border-radius-base 0 0);
2013-04-16 14:45:51 +00:00
&:hover {
border-color: @nav-tabs-link-hover-border-color @nav-tabs-link-hover-border-color @nav-tabs-border-color;
2013-04-16 14:45:51 +00:00
}
}
2013-12-16 02:13:50 +00:00
// Active state, and its :hover to override normal :hover
2013-07-07 04:51:47 +00:00
&.active > a {
&,
&:hover,
&:focus {
color: @nav-tabs-active-link-hover-color;
background-color: @nav-tabs-active-link-hover-bg;
border: 1px solid @nav-tabs-active-link-hover-border-color;
2013-07-07 04:51:47 +00:00
border-bottom-color: transparent;
cursor: default;
}
2013-04-16 14:45:51 +00:00
}
}
// pulling this in mainly for less shorthand
&.nav-justified {
2013-07-24 23:52:47 +00:00
.nav-justified();
.nav-tabs-justified();
}
}
2013-04-16 14:45:51 +00:00
// Pills
// -------------------------
2013-04-16 14:45:51 +00:00
.nav-pills {
> li {
float: left;
// Links rendered as pills
> a {
.border-radius(@nav-pills-border-radius);
2013-04-16 14:45:51 +00:00
}
+ li {
margin-left: 2px;
2013-04-16 14:45:51 +00:00
}
// Active state
2013-07-07 04:51:47 +00:00
&.active > a {
&,
&:hover,
&:focus {
color: @nav-pills-active-link-hover-color;
background-color: @nav-pills-active-link-hover-bg;
2013-07-07 04:51:47 +00:00
}
2013-04-16 14:45:51 +00:00
}
}
}
// Stacked pills
2013-04-16 14:45:51 +00:00
.nav-stacked {
> li {
float: none;
+ li {
2013-07-28 16:37:10 +00:00
margin-top: 2px;
margin-left: 0; // no need for this gap between nav items
2013-04-16 14:45:51 +00:00
}
}
}
// Nav variations
// --------------------------------------------------
// Justified nav links
// -------------------------
.nav-justified {
width: 100%;
> li {
float: none;
> a {
text-align: center;
margin-bottom: 5px;
}
}
> .dropdown .dropdown-menu {
top: auto;
left: auto;
}
@media (min-width: @screen-sm-min) {
> li {
display: table-cell;
width: 1%;
> a {
margin-bottom: 0;
}
}
}
}
// Move borders to anchors instead of bottom of list
2013-10-14 01:58:09 +00:00
//
// Mixin for adding on top the shared `.nav-justified` styles for our tabs
.nav-tabs-justified {
border-bottom: 0;
> li > a {
// Override margin from .nav-tabs
margin-right: 0;
.border-radius(@border-radius-base);
}
> .active > a,
> .active > a:hover,
> .active > a:focus {
border: 1px solid @nav-tabs-justified-link-border-color;
}
@media (min-width: @screen-sm-min) {
> li > a {
border-bottom: 1px solid @nav-tabs-justified-link-border-color;
.border-radius(@border-radius-base @border-radius-base 0 0);
}
> .active > a,
> .active > a:hover,
> .active > a:focus {
border-bottom-color: @nav-tabs-justified-active-link-border-color;
}
}
}
// Tabbable tabs
// -------------------------
// Hide tabbable panes to start, show them when `.active`
.tab-content {
> .tab-pane {
display: none;
}
2013-07-07 04:51:47 +00:00
> .active {
display: block;
}
}
// Dropdowns
// -------------------------
// Specific dropdowns
.nav-tabs .dropdown-menu {
// make dropdown border overlap tab border
margin-top: -1px;
2012-11-03 23:14:44 +00:00
// Remove the top rounded corners here since there is a hard edge above the menu
.border-top-radius(0);
}