1
0
Fork 0
mirror of https://github.com/twbs/bootstrap.git synced 2022-11-09 12:25:43 -05:00
twbs--bootstrap/less/navbar.less

369 lines
8.2 KiB
Text
Raw Normal View History

2012-06-29 00:46:45 -04:00
//
// Navbars
2012-06-29 00:46:45 -04:00
// --------------------------------------------------
// Wrapper and base class
.navbar {
position: relative;
padding: 0px 15px;
background-color: @navbar-bg;
2013-01-16 19:14:41 -05:00
border-radius: @border-radius-base;
// Prevent floats from breaking the navbar
.clearfix();
}
// Navbar nav links
2013-01-16 19:14:41 -05:00
// -------------------------
.navbar-nav {
// Space out from .navbar .brand and .btn-navbar
margin-top: 5px;
> li > a {
padding-top: ((@navbar-height - @line-height-base) / 2);
padding-bottom: ((@navbar-height - @line-height-base) / 2);
color: @navbar-link-color;
line-height: 20px;
}
> li > a:hover,
> li > a:focus {
2013-03-31 20:56:31 -04:00
color: @navbar-link-hover-color;
background-color: @navbar-link-hover-bg;
}
> .active > a,
> .active > a:hover,
> .active > a:focus {
2013-03-31 20:56:31 -04:00
color: @navbar-link-active-color;
background-color: @navbar-link-active-bg;
}
> .disabled > a,
> .disabled > a:hover,
> .disabled > a:focus {
2013-03-31 20:56:31 -04:00
color: @navbar-link-disabled-color;
background-color: @navbar-link-disabled-bg;
}
}
//
// Navbar alignment options
// --------------------------------------------------
// Static navbar
.navbar-static-top {
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;
border-radius: 0;
}
.navbar-fixed-top { top: 0; }
.navbar-fixed-bottom { bottom: 0; }
//
// Navbar optional components
// --------------------------------------------------
// Brand/project name
.navbar-brand {
display: block;
max-width: 200px;
margin-left: auto;
margin-right: auto;
padding: 15px;
font-size: 18px;
2013-01-17 23:30:40 -05:00
font-weight: 500;
2013-01-16 19:14:41 -05:00
line-height: @line-height-base;
color: @navbar-brand-color;
text-align: center;
&:hover,
&:focus {
2013-03-31 20:56:31 -04:00
color: @navbar-brand-hover-color;
text-decoration: none;
2013-03-31 20:56:31 -04:00
background-color: @navbar-brand-hover-bg;
}
}
// Collapsible navbar toggle
.navbar-toggle {
position: absolute;
top: 18px;
right: 10px;
padding: 8px 12px;
background-color: transparent;
border: 1px solid #ddd;
border-radius: 4px;
&:hover,
&:focus {
background-color: #ddd;
}
// Bars
.icon-bar {
display: block;
width: 22px;
height: 2px;
background-color: #ccc;
border-radius: 1px;
}
.icon-bar + .icon-bar {
margin-top: 4px;
}
}
// Navbar form
.navbar-form {
.navbar-vertical-align(34px); // Vertically center in navbar
}
2013-01-17 14:20:19 -05:00
2013-01-17 14:55:37 -05:00
// Dropdown menus
// Menu position and menu carets
.navbar-nav > li > .dropdown-menu {
2013-01-17 14:55:37 -05:00
margin-top: 0;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
// Menu position and menu caret support for dropups via extra dropup class
.navbar-fixed-bottom .navbar-nav > li > .dropdown-menu {
2013-01-17 14:55:37 -05:00
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
// Dropdown menu items and carets
.navbar-nav {
2013-01-17 14:55:37 -05:00
// Caret should match text color on hover
li.dropdown > a:hover .caret,
li.dropdown > a:focus .caret {
2013-03-31 20:56:31 -04:00
border-top-color: @navbar-link-hover-color;
border-bottom-color: @navbar-link-hover-color;
2013-01-17 14:55:37 -05:00
}
// Remove background color from open dropdown
li.dropdown.open > .dropdown-toggle,
li.dropdown.active > .dropdown-toggle,
li.dropdown.open.active > .dropdown-toggle {
2013-03-31 20:56:31 -04:00
background-color: @navbar-link-active-bg;
color: @navbar-link-active-color;
2013-01-17 14:55:37 -05:00
}
li.dropdown > .dropdown-toggle .caret {
border-top-color: @navbar-link-color;
border-bottom-color: @navbar-link-color;
}
li.dropdown.open > .dropdown-toggle .caret,
li.dropdown.active > .dropdown-toggle .caret,
li.dropdown.open.active > .dropdown-toggle .caret {
2013-03-31 20:56:31 -04:00
border-top-color: @navbar-link-active-color;
border-bottom-color: @navbar-link-active-color;
2013-01-17 14:55:37 -05:00
}
}
// Right aligned menus need alt position
.navbar-nav.pull-right > li > .dropdown-menu,
.navbar-nav > li > .dropdown-menu.pull-right {
2013-01-17 14:55:37 -05:00
left: auto;
right: 0;
}
2013-01-16 19:14:41 -05:00
// Inverse navbar
// --------------------------------------------------
2013-01-16 19:14:41 -05:00
.navbar-inverse {
2013-01-17 14:55:37 -05:00
background-color: @navbar-inverse-bg;
.navbar-brand {
color: @navbar-inverse-brand-color;
&:hover,
&:focus {
color: @navbar-inverse-brand-hover-color;
background-color: @navbar-inverse-brand-hover-bg;
}
}
.navbar-text {
color: @navbar-inverse-text;
}
.navbar-nav {
> li > a {
color: @navbar-inverse-link-color;
}
> li > a:hover,
> li > a:focus {
color: @navbar-inverse-link-hover-color;
background-color: @navbar-inverse-link-hover-bg;
}
> .active > a,
> .active > a:hover,
> .active > a:focus {
color: @navbar-inverse-link-active-color;
background-color: @navbar-inverse-link-active-bg;
}
> .disabled > a,
> .disabled > a:hover,
> .disabled > a:focus {
color: @navbar-inverse-link-disabled-color;
background-color: @navbar-inverse-link-disabled-bg;
}
}
2013-01-17 14:55:37 -05:00
// Darken the responsive nav toggle
.navbar-toggle {
border-color: #333;
&:hover,
&:focus {
background-color: #333;
}
.icon-bar {
background-color: #fff;
}
}
2013-01-17 14:55:37 -05:00
// Dropdowns
.navbar-nav {
li.dropdown.open > .dropdown-toggle,
li.dropdown.active > .dropdown-toggle,
li.dropdown.open.active > .dropdown-toggle {
background-color: @navbar-inverse-link-active-bg;
color: @navbar-inverse-link-active-color;
}
li.dropdown > a:hover .caret {
border-top-color: @navbar-inverse-link-hover-color;
border-bottom-color: @navbar-inverse-link-hover-color;
}
li.dropdown > .dropdown-toggle .caret {
border-top-color: @navbar-inverse-link-color;
border-bottom-color: @navbar-inverse-link-color;
}
li.dropdown.open > .dropdown-toggle .caret,
li.dropdown.active > .dropdown-toggle .caret,
li.dropdown.open.active > .dropdown-toggle .caret {
border-top-color: @navbar-inverse-link-active-color;
border-bottom-color: @navbar-inverse-link-active-color;
}
2013-01-17 14:55:37 -05:00
}
2013-01-16 19:14:41 -05:00
}
// Inverse navbar
2013-01-16 19:14:41 -05:00
// --------------------------------------------------
@media screen and (min-width: @screen-tablet) {
.navbar-brand {
float: left;
margin-left: -5px;
margin-right: 5px;
}
.navbar .nav {
float: left;
margin-top: 0; // undo top margin to make nav extend full height of navbar
> li {
float: left;
}
&.pull-right {
float: right;
}
}
// Dividers go vertical
// Change the height and height, disable bottom border, then add right border
.navbar .nav > .divider {
width: 1px;
height: (@navbar-height * .6);
margin: (@navbar-height * .2) 9px;
border-bottom: 0;
border-right: 1px solid lighten(@navbar-bg, 5%);
}
// Since we override the border, we need to specify it again for inverted navbars
.navbar-inverse .nav > .divider {
border-right-color: lighten(@navbar-inverse-bg, 5%);
}
// Required to make the collapsing navbar work on regular desktops
.navbar-toggle {
position: relative;
top: auto;
left: auto;
display: none;
}
.nav-collapse.collapse {
height: auto !important;
overflow: visible !important;
}
2013-01-17 14:55:37 -05:00
}
/*
// Janky solution for now to account for links outside the .nav
// -------------------------
.navbar-link {
2012-11-30 18:33:56 -05:00
color: @navbar-link-color;
&:hover {
2013-03-31 20:56:31 -04:00
color: @navbar-link-hover-color;
2012-01-14 20:16:46 -05:00
}
}
// Buttons in navbar
// -------------------------
.navbar .btn,
.navbar .btn-group {
.navbarVerticalAlign(30px); // Vertically center in navbar
}
.navbar .btn-group .btn,
.navbar .input-prepend .btn,
.navbar .input-append .btn {
margin-top: 0; // then undo the margin here so we don't accidentally double it
}
// Navbar forms
// -------------------------
.navbar-form {
margin-bottom: 0; // remove default bottom margin
.clearfix();
input,
select,
.radio,
.checkbox {
.navbarVerticalAlign(30px); // Vertically center in navbar
}
input,
select,
.btn {
display: inline-block;
margin-bottom: 0;
}
input[type="image"],
input[type="checkbox"],
input[type="radio"] {
margin-top: 3px;
}
.input-append,
.input-prepend {
margin-top: 5px;
white-space: nowrap; // preven two items from separating within a .navbar-form that has .pull-left
input {
margin-top: 0; // remove the margin on top since it's on the parent
}
}
}
*/