0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-10 22:24:19 +01:00
Bootstrap/less/navs.less
Mark Otto e57758cbb4 Drop .nav-header for .dropdown-header
* Since we no longer have `.nav-list`, I've nuked the `.nav-header`
* However, dropdowns can still have section headings, so I've kept that
around with the addition of `.dropdown-header`
* Restyled it a smidge as well
2013-07-17 23:54:09 -07:00

240 lines
4.2 KiB
Plaintext

//
// Navs
// --------------------------------------------------
// Base class
// --------------------------------------------------
.nav {
margin-bottom: 0;
padding-left: 0; // Override default ul/ol
list-style: none;
.clearfix();
> li {
position: relative;
display: block;
> a {
position: relative;
display: block;
padding: 10px 15px;
&:hover,
&:focus {
text-decoration: none;
background-color: @gray-lighter;
}
}
// Disabled state sets text to gray and nukes hover/tab effects
&.disabled > a {
color: @gray-light;
&:hover,
&:focus {
color: @gray-light;
text-decoration: none;
background-color: transparent;
cursor: default;
}
}
// Space the headers out when they follow another list item (link)
+ .nav-header {
margin-top: 9px;
}
}
// Open dropdowns
&.open > a {
&,
&:hover,
&:focus {
color: #fff;
background-color: @link-color;
border-color: @link-color;
.caret {
border-top-color: #fff;
border-bottom-color: #fff;
}
}
}
// Redeclare pull classes because of specificity
// Todo: consider making these utilities !important to avoid this bullshit
> .pull-right {
float: right;
}
// Dividers (basically an hr) within the dropdown
.nav-divider {
.nav-divider();
}
}
// Nav variations
// --------------------------------------------------
// Tabs
// -------------------------
// Give the tabs something to sit on
.nav-tabs {
border-bottom: 1px solid #ddd;
> li {
float: left;
// Make the list-items overlay the bottom border
margin-bottom: -1px;
// 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;
&:hover {
border-color: @gray-lighter @gray-lighter #ddd;
}
}
// Active state, and it's :hover to override normal :hover
&.active > a {
&,
&:hover,
&:focus {
color: @gray;
background-color: @body-bg;
border: 1px solid #ddd;
border-bottom-color: transparent;
cursor: default;
}
}
}
// pulling this in mainly for less shorthand
&.nav-justified {
.nav-justified;
.nav-tabs-justified;
}
}
// Pills
// -------------------------
.nav-pills {
> li {
float: left;
// Links rendered as pills
> a {
border-radius: 5px;
}
+ li {
> a {
margin-left: 2px;
}
}
// Active state
&.active > a {
&,
&:hover,
&:focus {
color: #fff;
background-color: @component-active-bg;
}
}
}
}
// Stacked pills
.nav-stacked {
> li {
float: none;
+ li {
> a {
margin-top: 2px;
margin-left: 0; // no need for this gap between nav items
}
}
}
}
// Justified nav links
// -------------------------
.nav-justified {
width: 100%;
> li {
float: none;
display: table-cell;
width: 1%;
> a {
text-align: center;
}
}
}
// Move borders to anchors instead of bottom of list
.nav-tabs-justified () {
border-bottom: 0;
> li > a {
border-bottom: 1px solid #ddd;
// Override margin from .nav-tabs
margin-right: 0;
}
> .active > a {
border-bottom-color: @body-bg;
}
}
// Tabbable tabs
// -------------------------
// Clear any floats
.tabbable {
.clearfix();
}
// Show/hide tabbable areas
.tab-content > .tab-pane,
.pill-content > .pill-pane {
display: none;
}
.tab-content,
.pill-content {
> .active {
display: block;
}
}
// Dropdowns
// -------------------------
// Make dropdown carets use link color in navs
.nav .caret {
border-top-color: @link-color;
border-bottom-color: @link-color;
}
.nav a:hover .caret {
border-top-color: @link-hover-color;
border-bottom-color: @link-hover-color;
}
// Specific dropdowns
.nav-tabs .dropdown-menu {
// make dropdown border overlap tab border
margin-top: -1px;
// Remove the top rounded corners here since there is a hard edge above the menu
.border-top-radius(0);
}