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

427 lines
9.7 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 {
padding: 15px;
background-color: @navbar-bg;
2013-01-16 19:14:41 -05:00
border-radius: @border-radius-base;
// Prevent floats from breaking the navbar
.clear_float();
}
// Navbar nav links
2013-01-16 19:14:41 -05:00
// -------------------------
.navbar {
.nav {
margin-top: 15px; // space out from .navbar .brand and .btn-navbar
}
.nav > 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;
}
.nav > li > a:hover,
.nav > li > a:focus {
color: @navbar-link-color-hover;
background-color: @navbar-link-bg-hover;
}
.nav > .active > a,
.nav > .active > a:hover,
.nav > .active > a:focus {
color: @navbar-link-color-active;
background-color: @navbar-link-bg-active;
}
}
//
// Navbar alignment options
// --------------------------------------------------
// Static navbar
.navbar-static-top {
position: static;
border-radius: 0;
}
// Fixed navbar
.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: inline-block;
padding: 7px 15px;
font-size: 18px;
font-weight: bold;
2013-01-16 19:14:41 -05:00
line-height: @line-height-base;
color: @navbar-brand-color;
&:hover {
2013-01-16 19:14:41 -05:00
color: @navbar-brand-color-hover;
text-decoration: none;
2013-01-16 19:14:41 -05:00
background-color: @navbar-brand-bg-hover;
}
}
// Collapsible navbar toggle
.btn-navbar {
float: right;
padding: 10px 12px;
background-color: #ddd;
border: 0;
border-radius: 4px;
// Bars
.icon-bar {
display: block;
width: 20px;
height: 2px;
background-color: #fff;
border-radius: 1px;
}
.icon-bar + .icon-bar {
margin-top: 3px;
}
}
// Dividers in navbar
.navbar .divider-vertical {
height: @navbar-height * .6;
margin: (@navbar-height * .2) 9px;
border-left: 1px solid darken(@navbar-bg, 5%);
border-right: 1px solid lighten(@navbar-bg, 5%);
}
2013-01-16 19:14:41 -05:00
// Navbar form
.navbar-form {
.navbar-vertical-align(32px); // Vertically center in navbar
}
2013-01-17 14:20:19 -05:00
2013-01-16 19:14:41 -05:00
// Inverse navbar
// --------------------------------------------------
2013-01-16 19:14:41 -05:00
.navbar-inverse {
background-color: @navbar-inverse-bg;
.brand {
color: @navbar-inverse-brand-color;
&:hover {
color: @navbar-inverse-brand-color-hover;
background-color: @navbar-inverse-brand-bg-hover;
}
}
.navbar-text {
color: @navbar-inverse-text;
}
.nav > li > a {
color: @navbar-inverse-link-color;
}
.nav > li > a:hover,
.nav > li > a:focus {
color: @navbar-inverse-link-color-hover;
background-color: @navbar-inverse-link-bg-hover;
}
.nav > .active > a,
.nav > .active > a:hover,
.nav > .active > a:focus {
color: @navbar-inverse-link-color-active;
background-color: @navbar-inverse-link-bg-active;
}
.btn-navbar {
background-color: #444;
}
.divider-vertical {
border-left-color: darken(@navbar-inverse-bg, 5%);
border-right-color: lighten(@navbar-inverse-bg, 5%);
}
2013-01-16 19:14:41 -05:00
}
// Inverse navbar
2013-01-16 19:14:41 -05:00
// --------------------------------------------------
@media screen and (min-width: 768px) {
.navbar {
padding-top: 0;
padding-bottom: 0;
}
.navbar .brand {
float: left;
padding-top: (@navbar-height - @line-height-base) / 2;
padding-bottom: (@navbar-height - @line-height-base) / 2;
margin-left: -15px;
}
.navbar .nav {
float: left;
margin-top: 0; // undo top margin to make nav extend full height of navbar
.clear_float();
&.pull-right {
float: right;
}
}
.navbar .nav > li {
float: left;
}
// Required to make the collapsing navbar work on regular desktops
.navbar .btn-navbar {
display: none;
}
.nav-collapse.collapse {
height: auto !important;
overflow: visible !important;
}
}
/*
// 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 {
2012-11-30 18:33:56 -05:00
color: @navbar-link-color-hover;
2012-01-14 20:16:46 -05:00
}
}
// Dividers in navbar
// -------------------------
.navbar .divider-vertical {
2012-11-30 18:33:56 -05:00
height: @navbar-height;
margin: 0 9px;
2012-11-30 18:33:56 -05:00
border-left: 1px solid @navbar-background;
border-right: 1px solid @navbar-background-highlight;
}
// 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
}
}
}
// Navbar search
// -------------------------
.navbar-search {
position: relative;
float: left;
2012-07-24 04:44:12 -04:00
.navbarVerticalAlign(30px); // Vertically center in navbar
margin-bottom: 0;
.search-query {
2012-07-13 13:58:20 -04:00
margin-bottom: 0;
2012-07-24 04:44:12 -04:00
padding: 4px 14px;
#font > .sans-serif(13px, normal, 1);
border-radius: 15px; // redeclare because of specificity of the type attribute
}
}
// Dropdown menus
// --------------
// Menu position and menu carets
.navbar .nav > li > .dropdown-menu {
&:before {
content: '';
display: inline-block;
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-bottom: 7px solid #ccc;
2012-11-30 18:09:57 -05:00
border-bottom-color: @dropdown-border;
position: absolute;
top: -7px;
left: 9px;
}
&:after {
content: '';
display: inline-block;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
2012-11-30 18:09:57 -05:00
border-bottom: 6px solid @dropdown-background;
position: absolute;
top: -6px;
left: 10px;
}
}
// Menu position and menu caret support for dropups via extra dropup class
.navbar-fixed-bottom .nav > li > .dropdown-menu {
&:before {
border-top: 7px solid #ccc;
2012-11-30 18:09:57 -05:00
border-top-color: @dropdown-border;
border-bottom: 0;
bottom: -7px;
top: auto;
}
&:after {
2012-11-30 18:09:57 -05:00
border-top: 6px solid @dropdown-background;
border-bottom: 0;
bottom: -6px;
top: auto;
}
}
// Caret should match text color on hover
.navbar .nav li.dropdown > a:hover .caret {
Merge branch '2.3.0-wip' into 3.0.0-wip Conflicts: Makefile README.md component.json docs/assets/css/bootstrap-responsive.css docs/assets/css/bootstrap.css docs/assets/js/bootstrap-affix.js docs/assets/js/bootstrap-alert.js docs/assets/js/bootstrap-button.js docs/assets/js/bootstrap-carousel.js docs/assets/js/bootstrap-collapse.js docs/assets/js/bootstrap-dropdown.js docs/assets/js/bootstrap-modal.js docs/assets/js/bootstrap-popover.js docs/assets/js/bootstrap-scrollspy.js docs/assets/js/bootstrap-tab.js docs/assets/js/bootstrap-tooltip.js docs/assets/js/bootstrap-transition.js docs/assets/js/bootstrap-typeahead.js docs/assets/js/bootstrap.js docs/components.html docs/css.html docs/examples/fluid.html docs/extend.html docs/getting-started.html docs/index.html docs/templates/pages/base-css.mustache docs/templates/pages/components.mustache docs/templates/pages/extend.mustache docs/templates/pages/getting-started.mustache docs/templates/pages/index.mustache docs/templates/pages/javascript.mustache js/bootstrap-affix.js js/bootstrap-alert.js js/bootstrap-button.js js/bootstrap-carousel.js js/bootstrap-collapse.js js/bootstrap-dropdown.js js/bootstrap-modal.js js/bootstrap-popover.js js/bootstrap-scrollspy.js js/bootstrap-tab.js js/bootstrap-tooltip.js js/bootstrap-transition.js js/bootstrap-typeahead.js less/bootstrap.less less/buttons.less less/forms.less less/navbar.less less/popovers.less less/responsive-767px-max.less less/responsive.less less/tables.less less/tooltip.less less/type.less less/variables.less package.json
2013-01-13 07:26:52 -05:00
border-top-color: @navbar-link-color-hover;
border-bottom-color: @navbar-link-color-hover;
}
// Remove background color from open dropdown
.navbar .nav li.dropdown.open > .dropdown-toggle,
.navbar .nav li.dropdown.active > .dropdown-toggle,
.navbar .nav li.dropdown.open.active > .dropdown-toggle {
2012-11-30 18:33:56 -05:00
background-color: @navbar-link-background-active;
color: @navbar-link-color-active;
}
.navbar .nav li.dropdown > .dropdown-toggle .caret {
2012-11-30 18:33:56 -05:00
border-top-color: @navbar-link-color;
border-bottom-color: @navbar-link-color;
}
.navbar .nav li.dropdown.open > .dropdown-toggle .caret,
.navbar .nav li.dropdown.active > .dropdown-toggle .caret,
.navbar .nav li.dropdown.open.active > .dropdown-toggle .caret {
2012-11-30 18:33:56 -05:00
border-top-color: @navbar-link-color-active;
border-bottom-color: @navbar-link-color-active;
}
// Right aligned menus need alt position
.navbar .pull-right > li > .dropdown-menu,
.navbar .nav > li > .dropdown-menu.pull-right {
left: auto;
right: 0;
&:before {
left: auto;
right: 12px;
}
&:after {
left: auto;
right: 13px;
}
.dropdown-menu {
left: auto;
right: 100%;
margin-left: 0;
margin-right: -1px;
border-radius: 6px 0 6px 6px;
}
2012-06-15 16:07:44 -04:00
}
// Inverted navbar
// -------------------------
.navbar-inverse {
// Dropdowns
.nav li.dropdown.open > .dropdown-toggle,
.nav li.dropdown.active > .dropdown-toggle,
.nav li.dropdown.open.active > .dropdown-toggle {
2012-11-30 18:33:56 -05:00
background-color: @navbar-inverse-link-background-active;
color: @navbar-inverse-link-color-active;
}
.nav li.dropdown > a:hover .caret {
2012-11-30 18:33:56 -05:00
border-top-color: @navbar-inverse-link-color-active;
border-bottom-color: @navbar-inverse-link-color-active;
}
.nav li.dropdown > .dropdown-toggle .caret {
2012-11-30 18:33:56 -05:00
border-top-color: @navbar-inverse-link-color;
border-bottom-color: @navbar-inverse-link-color;
}
.nav li.dropdown.open > .dropdown-toggle .caret,
.nav li.dropdown.active > .dropdown-toggle .caret,
.nav li.dropdown.open.active > .dropdown-toggle .caret {
2012-11-30 18:33:56 -05:00
border-top-color: @navbar-inverse-link-color-active;
border-bottom-color: @navbar-inverse-link-color-active;
}
// Navbar search
.navbar-search {
.search-query {
2012-11-30 18:05:23 -05:00
color: #fff;
2012-11-30 18:33:56 -05:00
background-color: @navbar-inverse-search-background;
border-color: @navbar-inverse-search-border;
.box-shadow(~"inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.15)");
.transition(none);
2012-11-30 18:33:56 -05:00
.placeholder(@navbar-inverse-search-placeholder-color);
2012-09-26 01:07:53 -04:00
// Focus states (we use .focused since IE8 and down doesn't support :focus)
&:focus,
&.focused {
padding: 5px 15px;
color: @grayDark;
2012-11-30 18:05:23 -05:00
text-shadow: 0 1px 0 #fff;
2012-11-30 18:33:56 -05:00
background-color: @navbar-inverse-search-background-focus;
border: 0;
.box-shadow(0 0 3px rgba(0,0,0,.15));
outline: 0;
}
}
}
}
*/