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

Merge branch '2.0.3-wip-nav-collapse' of https://github.com/tierra/bootstrap into tierra-2.0.3-wip-nav-collapse

Conflicts:
	docs/assets/bootstrap.zip
This commit is contained in:
Mark Otto 2012-04-14 22:43:26 -07:00
commit 8dc1a0eade
7 changed files with 202 additions and 144 deletions

Binary file not shown.

View file

@ -623,27 +623,27 @@
margin: 0 0 0 -5px; margin: 0 0 0 -5px;
} }
.navbar .nav-collapse { .navbar .nav-collapse {
clear: left; clear: both;
} }
.navbar .nav { .navbar .nav-collapse .nav {
float: none; float: none;
margin: 0 0 9px; margin: 0 0 9px;
} }
.navbar .nav > li { .navbar .nav-collapse .nav > li {
float: none; float: none;
} }
.navbar .nav > li > a { .navbar .nav-collapse .nav > li > a {
margin-bottom: 2px; margin-bottom: 2px;
} }
.navbar .nav > .divider-vertical { .navbar .nav-collapse .nav > .divider-vertical {
display: none; display: none;
} }
.navbar .nav .nav-header { .navbar .nav-collapse .nav .nav-header {
color: #999999; color: #999999;
text-shadow: none; text-shadow: none;
} }
.navbar .nav > li > a, .navbar .nav-collapse .nav > li > a,
.navbar .dropdown-menu a { .navbar .nav-collapse .dropdown-menu a {
padding: 6px 15px; padding: 6px 15px;
font-weight: bold; font-weight: bold;
color: #999999; color: #999999;
@ -651,14 +651,25 @@
-moz-border-radius: 3px; -moz-border-radius: 3px;
border-radius: 3px; border-radius: 3px;
} }
.navbar .dropdown-menu li + li a { .navbar .nav-collapse .btn {
padding: 4px 10px 4px;
font-weight: normal;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.navbar .nav-collapse .dropdown-menu li + li a {
margin-bottom: 2px; margin-bottom: 2px;
} }
.navbar .nav > li > a:hover, .navbar .nav-collapse .nav > li > a:hover,
.navbar .dropdown-menu a:hover { .navbar .nav-collapse .dropdown-menu a:hover {
background-color: #222222; background-color: #222222;
} }
.navbar .dropdown-menu { .navbar .nav-collapse.in .btn-group {
margin-top: 5px;
padding: 0;
}
.navbar .nav-collapse .dropdown-menu {
position: static; position: static;
top: auto; top: auto;
left: auto; left: auto;
@ -676,15 +687,15 @@
-moz-box-shadow: none; -moz-box-shadow: none;
box-shadow: none; box-shadow: none;
} }
.navbar .dropdown-menu:before, .navbar .nav-collapse .dropdown-menu:before,
.navbar .dropdown-menu:after { .navbar .nav-collapse .dropdown-menu:after {
display: none; display: none;
} }
.navbar .dropdown-menu .divider { .navbar .nav-collapse .dropdown-menu .divider {
display: none; display: none;
} }
.navbar-form, .nav-collapse .navbar-form,
.navbar-search { .nav-collapse .navbar-search {
float: none; float: none;
padding: 9px 15px; padding: 9px 15px;
margin: 9px 0; margin: 9px 0;
@ -694,7 +705,7 @@
-moz-box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1); -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1);
box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1); box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1);
} }
.navbar .nav.pull-right { .navbar .nav-collapse .nav.pull-right {
float: none; float: none;
margin-left: 0; margin-left: 0;
} }
@ -702,7 +713,7 @@
padding-left: 10px; padding-left: 10px;
padding-right: 10px; padding-right: 10px;
} }
.btn-navbar { .navbar .btn-navbar {
display: block; display: block;
} }
.nav-collapse, .nav-collapse,

View file

@ -2824,14 +2824,14 @@ input[type="submit"].btn.btn-mini {
} }
.nav-tabs .open .dropdown-toggle, .nav-tabs .open .dropdown-toggle,
.nav-pills .open .dropdown-toggle, .nav-pills .open .dropdown-toggle,
.nav > .open.active > a:hover { .nav > li.dropdown.open.active > a:hover {
color: #ffffff; color: #ffffff;
background-color: #999999; background-color: #999999;
border-color: #999999; border-color: #999999;
} }
.nav .open .caret, .nav li.dropdown.open .caret,
.nav .open.active .caret, .nav li.dropdown.open.active .caret,
.nav .open a:hover .caret { .nav li.dropdown.open a:hover .caret {
border-top-color: #ffffff; border-top-color: #ffffff;
border-bottom-color: #ffffff; border-bottom-color: #ffffff;
opacity: 1; opacity: 1;
@ -2964,58 +2964,6 @@ input[type="submit"].btn.btn-mini {
.navbar .container { .navbar .container {
width: auto; width: auto;
} }
.btn-navbar {
display: none;
float: right;
padding: 7px 10px;
margin-left: 5px;
margin-right: 5px;
background-color: #2c2c2c;
background-image: -moz-linear-gradient(top, #333333, #222222);
background-image: -ms-linear-gradient(top, #333333, #222222);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#333333), to(#222222));
background-image: -webkit-linear-gradient(top, #333333, #222222);
background-image: -o-linear-gradient(top, #333333, #222222);
background-image: linear-gradient(top, #333333, #222222);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333', endColorstr='#222222', GradientType=0);
border-color: #222222 #222222 #000000;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
*background-color: #222222;
/* Darken IE7 buttons by default so they stand out more given they won't have borders */
-webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075);
-moz-box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075);
box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075);
}
.btn-navbar:hover,
.btn-navbar:active,
.btn-navbar.active,
.btn-navbar.disabled,
.btn-navbar[disabled] {
background-color: #222222;
*background-color: #151515;
}
.btn-navbar:active,
.btn-navbar.active {
background-color: #080808 \9;
}
.btn-navbar .icon-bar {
display: block;
width: 18px;
height: 2px;
background-color: #f5f5f5;
-webkit-border-radius: 1px;
-moz-border-radius: 1px;
border-radius: 1px;
-webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
-moz-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}
.btn-navbar .icon-bar + .icon-bar {
margin-top: 3px;
}
.nav-collapse.collapse { .nav-collapse.collapse {
height: auto; height: auto;
} }
@ -3050,7 +2998,7 @@ input[type="submit"].btn.btn-mini {
margin-top: 5px; margin-top: 5px;
} }
.navbar .btn-group .btn { .navbar .btn-group .btn {
margin-top: 0; margin: 0;
} }
.navbar-form { .navbar-form {
margin-bottom: 0; margin-bottom: 0;
@ -3179,6 +3127,16 @@ input[type="submit"].btn.btn-mini {
text-decoration: none; text-decoration: none;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
} }
.navbar .btn {
display: inline-block;
padding: 4px 10px 4px;
margin: 5px 5px 6px;
line-height: 18px;
}
.navbar .btn-group {
margin: 0;
padding: 5px 5px 6px;
}
.navbar .nav > li > a:hover { .navbar .nav > li > a:hover {
background-color: transparent; background-color: transparent;
color: #ffffff; color: #ffffff;
@ -3202,6 +3160,58 @@ input[type="submit"].btn.btn-mini {
margin-left: 10px; margin-left: 10px;
margin-right: 0; margin-right: 0;
} }
.navbar .btn-navbar {
display: none;
float: right;
padding: 7px 10px;
margin-left: 5px;
margin-right: 5px;
background-color: #2c2c2c;
background-image: -moz-linear-gradient(top, #333333, #222222);
background-image: -ms-linear-gradient(top, #333333, #222222);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#333333), to(#222222));
background-image: -webkit-linear-gradient(top, #333333, #222222);
background-image: -o-linear-gradient(top, #333333, #222222);
background-image: linear-gradient(top, #333333, #222222);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333', endColorstr='#222222', GradientType=0);
border-color: #222222 #222222 #000000;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
*background-color: #222222;
/* Darken IE7 buttons by default so they stand out more given they won't have borders */
-webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075);
-moz-box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075);
box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075);
}
.navbar .btn-navbar:hover,
.navbar .btn-navbar:active,
.navbar .btn-navbar.active,
.navbar .btn-navbar.disabled,
.navbar .btn-navbar[disabled] {
background-color: #222222;
*background-color: #151515;
}
.navbar .btn-navbar:active,
.navbar .btn-navbar.active {
background-color: #080808 \9;
}
.navbar .btn-navbar .icon-bar {
display: block;
width: 18px;
height: 2px;
background-color: #f5f5f5;
-webkit-border-radius: 1px;
-moz-border-radius: 1px;
border-radius: 1px;
-webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
-moz-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}
.btn-navbar .icon-bar + .icon-bar {
margin-top: 3px;
}
.navbar .dropdown-menu:before { .navbar .dropdown-menu:before {
content: ''; content: '';
display: inline-block; display: inline-block;
@ -3236,35 +3246,35 @@ input[type="submit"].btn.btn-mini {
bottom: -6px; bottom: -6px;
top: auto; top: auto;
} }
.navbar .nav .dropdown-toggle .caret, .navbar .nav li.dropdown .dropdown-toggle .caret,
.navbar .nav .open .caret { .navbar .nav li.dropdown.open .caret {
border-top-color: #ffffff; border-top-color: #ffffff;
border-bottom-color: #ffffff; border-bottom-color: #ffffff;
} }
.navbar .nav .active .caret { .navbar .nav li.dropdown.active .caret {
opacity: 1; opacity: 1;
filter: alpha(opacity=100); filter: alpha(opacity=100);
} }
.navbar .nav .open > .dropdown-toggle, .navbar .nav li.dropdown.open > .dropdown-toggle,
.navbar .nav .active > .dropdown-toggle, .navbar .nav li.dropdown.active > .dropdown-toggle,
.navbar .nav .open.active > .dropdown-toggle { .navbar .nav li.dropdown.open.active > .dropdown-toggle {
background-color: transparent; background-color: transparent;
} }
.navbar .nav .active > .dropdown-toggle:hover { .navbar .nav li.dropdown.active > .dropdown-toggle:hover {
color: #ffffff; color: #ffffff;
} }
.navbar .nav.pull-right .dropdown-menu, .navbar .pull-right .dropdown-menu,
.navbar .nav .dropdown-menu.pull-right { .navbar .dropdown-menu.pull-right {
left: auto; left: auto;
right: 0; right: 0;
} }
.navbar .nav.pull-right .dropdown-menu:before, .navbar .pull-right .dropdown-menu:before,
.navbar .nav .dropdown-menu.pull-right:before { .navbar .dropdown-menu.pull-right:before {
left: auto; left: auto;
right: 12px; right: 12px;
} }
.navbar .nav.pull-right .dropdown-menu:after, .navbar .pull-right .dropdown-menu:after,
.navbar .nav .dropdown-menu.pull-right:after { .navbar .dropdown-menu.pull-right:after {
left: auto; left: auto;
right: 13px; right: 13px;
} }

View file

@ -44,13 +44,23 @@
<span class="icon-bar"></span> <span class="icon-bar"></span>
</a> </a>
<a class="brand" href="#">Project name</a> <a class="brand" href="#">Project name</a>
<div class="btn-group pull-right">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
<i class="icon-user"></i> Username
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li><a href="#">Profile</a></li>
<li class="divider"></li>
<li><a href="#">Sign Out</a></li>
</ul>
</div>
<div class="nav-collapse"> <div class="nav-collapse">
<ul class="nav"> <ul class="nav">
<li class="active"><a href="#">Home</a></li> <li class="active"><a href="#">Home</a></li>
<li><a href="#about">About</a></li> <li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li> <li><a href="#contact">Contact</a></li>
</ul> </ul>
<p class="navbar-text pull-right">Logged in as <a class="navbar-link" href="#">username</a></p>
</div><!--/.nav-collapse --> </div><!--/.nav-collapse -->
</div> </div>
</div> </div>

View file

@ -30,27 +30,6 @@
width: auto; width: auto;
} }
// Navbar button for toggling navbar items in responsive layouts
.btn-navbar {
display: none;
float: right;
padding: 7px 10px;
margin-left: 5px;
margin-right: 5px;
.buttonBackground(@navbarBackgroundHighlight, @navbarBackground);
.box-shadow(~"inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075)");
}
.btn-navbar .icon-bar {
display: block;
width: 18px;
height: 2px;
background-color: #f5f5f5;
.border-radius(1px);
.box-shadow(0 1px 0 rgba(0,0,0,.25));
}
.btn-navbar .icon-bar + .icon-bar {
margin-top: 3px;
}
// Override the default collapsed state // Override the default collapsed state
.nav-collapse.collapse { .nav-collapse.collapse {
height: auto; height: auto;
@ -95,7 +74,7 @@
.navbarVerticalAlign(30px); // Vertically center in navbar .navbarVerticalAlign(30px); // Vertically center in navbar
} }
.btn-group .btn { .btn-group .btn {
margin-top: 0; // then undo the margin here so we don't accidentally double it margin: 0; // then undo the margin here so we don't accidentally double it
} }
} }
@ -233,6 +212,21 @@
text-decoration: none; text-decoration: none;
text-shadow: 0 -1px 0 rgba(0,0,0,.25); text-shadow: 0 -1px 0 rgba(0,0,0,.25);
} }
// Buttons
.navbar .btn {
display: inline-block;
padding: 4px 10px 4px;
// Vertically center the button given @navbarHeight
@elementHeight: 28px;
margin: ((@navbarHeight - @elementHeight) / 2 - 1) 5px ((@navbarHeight - @elementHeight) / 2);
line-height: @baseLineHeight;
}
.navbar .btn-group {
margin: 0;
// Vertically center the button given @navbarHeight
@elementHeight: 28px;
padding: ((@navbarHeight - @elementHeight) / 2 - 1) 5px ((@navbarHeight - @elementHeight) / 2);
}
// Hover // Hover
.navbar .nav > li > a:hover { .navbar .nav > li > a:hover {
background-color: @navbarLinkBackgroundHover; // "transparent" is default to differentiate :hover from .active background-color: @navbarLinkBackgroundHover; // "transparent" is default to differentiate :hover from .active
@ -264,6 +258,28 @@
margin-right: 0; margin-right: 0;
} }
// Navbar button for toggling navbar items in responsive layouts
// These definitions need to come after '.navbar .btn'
.navbar .btn-navbar {
display: none;
float: right;
padding: 7px 10px;
margin-left: 5px;
margin-right: 5px;
.buttonBackground(@navbarBackgroundHighlight, @navbarBackground);
.box-shadow(~"inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075)");
}
.navbar .btn-navbar .icon-bar {
display: block;
width: 18px;
height: 2px;
background-color: #f5f5f5;
.border-radius(1px);
.box-shadow(0 1px 0 rgba(0,0,0,.25));
}
.btn-navbar .icon-bar + .icon-bar {
margin-top: 3px;
}
// Dropdown menus // Dropdown menus
@ -310,31 +326,31 @@
} }
} }
// Dropdown toggle caret // Dropdown toggle caret
.navbar .nav .dropdown-toggle .caret, .navbar .nav li.dropdown .dropdown-toggle .caret,
.navbar .nav .open .caret { .navbar .nav li.dropdown.open .caret {
border-top-color: @white; border-top-color: @white;
border-bottom-color: @white; border-bottom-color: @white;
} }
.navbar .nav .active .caret { .navbar .nav li.dropdown.active .caret {
.opacity(100); .opacity(100);
} }
// Remove background color from open dropdown // Remove background color from open dropdown
.navbar .nav .open > .dropdown-toggle, .navbar .nav li.dropdown.open > .dropdown-toggle,
.navbar .nav .active > .dropdown-toggle, .navbar .nav li.dropdown.active > .dropdown-toggle,
.navbar .nav .open.active > .dropdown-toggle { .navbar .nav li.dropdown.open.active > .dropdown-toggle {
background-color: transparent; background-color: transparent;
} }
// Dropdown link on hover // Dropdown link on hover
.navbar .nav .active > .dropdown-toggle:hover { .navbar .nav li.dropdown.active > .dropdown-toggle:hover {
color: @white; color: @white;
} }
// Right aligned menus need alt position // Right aligned menus need alt position
// TODO: rejigger this at some point to simplify the selectors // TODO: rejigger this at some point to simplify the selectors
.navbar .nav.pull-right .dropdown-menu, .navbar .pull-right .dropdown-menu,
.navbar .nav .dropdown-menu.pull-right { .navbar .dropdown-menu.pull-right {
left: auto; left: auto;
right: 0; right: 0;
&:before { &:before {

View file

@ -234,14 +234,14 @@
// ------------------------- // -------------------------
.nav-tabs .open .dropdown-toggle, .nav-tabs .open .dropdown-toggle,
.nav-pills .open .dropdown-toggle, .nav-pills .open .dropdown-toggle,
.nav > .open.active > a:hover { .nav > li.dropdown.open.active > a:hover {
color: @white; color: @white;
background-color: @grayLight; background-color: @grayLight;
border-color: @grayLight; border-color: @grayLight;
} }
.nav .open .caret, .nav li.dropdown.open .caret,
.nav .open.active .caret, .nav li.dropdown.open.active .caret,
.nav .open a:hover .caret { .nav li.dropdown.open a:hover .caret {
border-top-color: @white; border-top-color: @white;
border-bottom-color: @white; border-bottom-color: @white;
.opacity(100); .opacity(100);

View file

@ -28,43 +28,54 @@
} }
// Nav collapse clears brand // Nav collapse clears brand
.navbar .nav-collapse { .navbar .nav-collapse {
clear: left; clear: both;
} }
// Block-level the nav // Block-level the nav
.navbar .nav { .navbar .nav-collapse .nav {
float: none; float: none;
margin: 0 0 (@baseLineHeight / 2); margin: 0 0 (@baseLineHeight / 2);
} }
.navbar .nav > li { .navbar .nav-collapse .nav > li {
float: none; float: none;
} }
.navbar .nav > li > a { .navbar .nav-collapse .nav > li > a {
margin-bottom: 2px; margin-bottom: 2px;
} }
.navbar .nav > .divider-vertical { .navbar .nav-collapse .nav > .divider-vertical {
display: none; display: none;
} }
.navbar .nav .nav-header { .navbar .nav-collapse .nav .nav-header {
color: @navbarText; color: @navbarText;
text-shadow: none; text-shadow: none;
} }
// Nav and dropdown links in navbar // Nav and dropdown links in navbar
.navbar .nav > li > a, .navbar .nav-collapse .nav > li > a,
.navbar .dropdown-menu a { .navbar .nav-collapse .dropdown-menu a {
padding: 6px 15px; padding: 6px 15px;
font-weight: bold; font-weight: bold;
color: @navbarLinkColor; color: @navbarLinkColor;
.border-radius(3px); .border-radius(3px);
} }
.navbar .dropdown-menu li + li a { // Buttons
.navbar .nav-collapse .btn {
padding: 4px 10px 4px;
font-weight: normal;
.border-radius(4px);
}
.navbar .nav-collapse .dropdown-menu li + li a {
margin-bottom: 2px; margin-bottom: 2px;
} }
.navbar .nav > li > a:hover, .navbar .nav-collapse .nav > li > a:hover,
.navbar .dropdown-menu a:hover { .navbar .nav-collapse .dropdown-menu a:hover {
background-color: @navbarBackground; background-color: @navbarBackground;
} }
// Buttons in the navbar
.navbar .nav-collapse.in .btn-group {
margin-top: 5px;
padding: 0;
}
// Dropdowns in the navbar // Dropdowns in the navbar
.navbar .dropdown-menu { .navbar .nav-collapse .dropdown-menu {
position: static; position: static;
top: auto; top: auto;
left: auto; left: auto;
@ -78,16 +89,16 @@
.border-radius(0); .border-radius(0);
.box-shadow(none); .box-shadow(none);
} }
.navbar .dropdown-menu:before, .navbar .nav-collapse .dropdown-menu:before,
.navbar .dropdown-menu:after { .navbar .nav-collapse .dropdown-menu:after {
display: none; display: none;
} }
.navbar .dropdown-menu .divider { .navbar .nav-collapse .dropdown-menu .divider {
display: none; display: none;
} }
// Forms in navbar // Forms in navbar
.navbar-form, .nav-collapse .navbar-form,
.navbar-search { .nav-collapse .navbar-search {
float: none; float: none;
padding: (@baseLineHeight / 2) 15px; padding: (@baseLineHeight / 2) 15px;
margin: (@baseLineHeight / 2) 0; margin: (@baseLineHeight / 2) 0;
@ -96,7 +107,7 @@
.box-shadow(~"inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1)"); .box-shadow(~"inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1)");
} }
// Pull right (secondary) nav content // Pull right (secondary) nav content
.navbar .nav.pull-right { .navbar .nav-collapse .nav.pull-right {
float: none; float: none;
margin-left: 0; margin-left: 0;
} }
@ -106,7 +117,7 @@
padding-right: 10px; padding-right: 10px;
} }
// Navbar button // Navbar button
.btn-navbar { .navbar .btn-navbar {
display: block; display: block;
} }