twbs--bootstrap/less/navs.less

298 lines
5.6 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-left: 0;
margin-bottom: 0;
padding-left: 0; // Override default ul/ol
list-style: none;
.clearfix();
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: 10px 15px;
&:hover,
&:focus {
text-decoration: none;
background-color: @gray-lighter;
2013-04-16 14:45:51 +00:00
}
}
// Nav states and addons
// --------------------------------------------------
// Disabled state
// -------------------------
// Gray out text
&.disabled > a {
color: @gray-light;
2013-04-16 14:45:51 +00:00
}
// Nuke hover effects
&.disabled > a:hover,
&.disabled > a:focus {
color: @gray-light;
2013-04-16 14:45:51 +00:00
text-decoration: none;
background-color: transparent;
cursor: default;
}
// Space the headers out when they follow another list item (link)
+ .nav-header {
2013-04-16 14:45:51 +00:00
margin-top: 9px;
}
}
2013-04-16 14:45:51 +00:00
// Redeclare pull classes because of specifity
// Todo: consider making these utilities !important to avoid this bullshit
> .pull-right {
float: right;
}
2013-04-16 14:45:51 +00:00
// Dividers (basically an hr) within the dropdown
.nav-divider {
2013-04-16 14:45:51 +00:00
.nav-divider();
}
}
// Nav variations
// --------------------------------------------------
2012-11-03 23:14:44 +00:00
// Tabs
// -------------------------
// Give the tabs something to sit on
.nav-tabs {
border-bottom: 1px solid #ddd;
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;
&:hover {
border-color: @gray-lighter @gray-lighter #ddd;
2013-04-16 14:45:51 +00:00
}
}
// Active state, and it's :hover to override normal :hover
&.active > a,
&.active > a:hover,
&.active > a:focus {
color: @gray;
background-color: @body-bg;
border: 1px solid #ddd;
border-bottom-color: transparent;
cursor: default;
2013-04-16 14:45:51 +00:00
}
}
// pulling this in mainly for less shorthand
&.nav-justified {
.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: 5px;
}
+ li {
> a {
margin-left: 2px;
}
}
// Active state
&.active > a,
&.active > a:hover,
&.active > a:focus {
color: #fff;
background-color: @component-active-bg;
2013-04-16 14:45:51 +00:00
}
}
}
// Stacked pills
2013-04-16 14:45:51 +00:00
.nav-stacked {
> li {
float: none;
+ li {
> a {
margin-top: 2px;
margin-left: 0; // no need for this gap between nav items
2013-04-16 14:45:51 +00:00
}
}
}
}
// Justified nav links
// -------------------------
.nav-justified {
width: 100%;
2013-04-16 14:45:51 +00:00
> li {
float: none;
display: table-cell;
width: 1%;
> a {
text-align: center;
}
2013-04-16 14:45:51 +00:00
}
}
2013-04-16 14:45:51 +00:00
// Move borders to anchors instead of bottom of list
2013-04-16 14:45:51 +00:00
.nav-tabs-justified () {
border-bottom: 0;
> li > a {
border-bottom: 1px solid #ddd;
2013-04-16 14:45:51 +00:00
// Override margin from .nav-tabs
margin-right: 0;
}
> .active > a {
border-bottom-color: @body-bg;
}
2012-11-03 23:14:44 +00:00
2013-04-16 14:45:51 +00:00
}
// Nav headers (for dropdowns and lists)
// -------------------------
.nav-header {
display: block;
padding: 3px 15px;
font-size: @font-size-mini;
font-weight: bold;
line-height: @line-height-base;
color: @gray-light;
text-shadow: 0 1px 0 rgba(255,255,255,.5);
text-transform: uppercase;
}
// Tabbable tabs
// -------------------------
// Clear any floats
.tabbable {
.clearfix();
}
// Show/hide tabbable areas
.tab-content > .tab-pane,
.pill-content > .pill-pane {
display: none;
}
.tab-content > .active,
.pill-content > .active {
display: block;
}
// Dropdowns
// -------------------------
.nav-tabs .dropdown-menu {
// Remove the top rounded corners here since there is a hard edge above the menu
.border-top-radius(0);
}
/*
// Prevent IE8 from misplacing imgs
// See https://github.com/h5bp/html5-boilerplate/issues/984#issuecomment-3985989
.nav > li > a > img {
max-width: none;
}
2012-11-03 23:14:44 +00:00
// Dropdowns
// -------------------------
.nav-tabs .dropdown-menu {
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);
}
// Default dropdown links
// -------------------------
// Make carets use linkColor to start
2012-06-25 03:42:31 +00:00
.nav .dropdown-toggle .caret {
2012-11-30 22:37:24 +00:00
border-top-color: @link-color;
border-bottom-color: @link-color;
2012-11-03 23:14:44 +00:00
margin-top: 8px;
}
2012-06-25 03:42:31 +00:00
.nav .dropdown-toggle:hover .caret {
2013-04-01 00:27:22 +00:00
border-top-color: @link-hover-color;
border-bottom-color: @link-hover-color;
}
// Active dropdown links
// -------------------------
2012-06-25 03:42:31 +00:00
.nav .active .dropdown-toggle .caret {
border-top-color: #fff;
border-bottom-color: #fff;
}
.nav-tabs .active .dropdown-toggle .caret {
border-top-color: @gray;
border-bottom-color: @gray;
}
// Active:hover dropdown links
// -------------------------
.nav > .dropdown.active > a:hover {
cursor: pointer;
}
// Open dropdowns
// -------------------------
.nav-tabs .open .dropdown-toggle,
.nav-pills .open .dropdown-toggle,
.nav > li.dropdown.open.active > a:hover {
2012-11-30 23:05:23 +00:00
color: #fff;
background-color: @gray-light;
border-color: @gray-light;
}
.nav li.dropdown.open .caret,
.nav li.dropdown.open.active .caret,
.nav li.dropdown.open a:hover .caret {
2012-11-30 23:05:23 +00:00
border-top-color: #fff;
border-bottom-color: #fff;
.opacity(1);
}
// Dropdowns in stacked tabs
.tabs-stacked .open > a:hover {
border-color: @gray-light;
}
*/