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;
}
.navbar .nav-collapse {
clear: left;
clear: both;
}
.navbar .nav {
.navbar .nav-collapse .nav {
float: none;
margin: 0 0 9px;
}
.navbar .nav > li {
.navbar .nav-collapse .nav > li {
float: none;
}
.navbar .nav > li > a {
.navbar .nav-collapse .nav > li > a {
margin-bottom: 2px;
}
.navbar .nav > .divider-vertical {
.navbar .nav-collapse .nav > .divider-vertical {
display: none;
}
.navbar .nav .nav-header {
.navbar .nav-collapse .nav .nav-header {
color: #999999;
text-shadow: none;
}
.navbar .nav > li > a,
.navbar .dropdown-menu a {
.navbar .nav-collapse .nav > li > a,
.navbar .nav-collapse .dropdown-menu a {
padding: 6px 15px;
font-weight: bold;
color: #999999;
@ -651,14 +651,25 @@
-moz-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;
}
.navbar .nav > li > a:hover,
.navbar .dropdown-menu a:hover {
.navbar .nav-collapse .nav > li > a:hover,
.navbar .nav-collapse .dropdown-menu a:hover {
background-color: #222222;
}
.navbar .dropdown-menu {
.navbar .nav-collapse.in .btn-group {
margin-top: 5px;
padding: 0;
}
.navbar .nav-collapse .dropdown-menu {
position: static;
top: auto;
left: auto;
@ -676,15 +687,15 @@
-moz-box-shadow: none;
box-shadow: none;
}
.navbar .dropdown-menu:before,
.navbar .dropdown-menu:after {
.navbar .nav-collapse .dropdown-menu:before,
.navbar .nav-collapse .dropdown-menu:after {
display: none;
}
.navbar .dropdown-menu .divider {
.navbar .nav-collapse .dropdown-menu .divider {
display: none;
}
.navbar-form,
.navbar-search {
.nav-collapse .navbar-form,
.nav-collapse .navbar-search {
float: none;
padding: 9px 15px;
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);
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;
margin-left: 0;
}
@ -702,7 +713,7 @@
padding-left: 10px;
padding-right: 10px;
}
.btn-navbar {
.navbar .btn-navbar {
display: block;
}
.nav-collapse,

View file

@ -2824,14 +2824,14 @@ input[type="submit"].btn.btn-mini {
}
.nav-tabs .open .dropdown-toggle,
.nav-pills .open .dropdown-toggle,
.nav > .open.active > a:hover {
.nav > li.dropdown.open.active > a:hover {
color: #ffffff;
background-color: #999999;
border-color: #999999;
}
.nav .open .caret,
.nav .open.active .caret,
.nav .open a:hover .caret {
.nav li.dropdown.open .caret,
.nav li.dropdown.open.active .caret,
.nav li.dropdown.open a:hover .caret {
border-top-color: #ffffff;
border-bottom-color: #ffffff;
opacity: 1;
@ -2964,58 +2964,6 @@ input[type="submit"].btn.btn-mini {
.navbar .container {
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 {
height: auto;
}
@ -3050,7 +2998,7 @@ input[type="submit"].btn.btn-mini {
margin-top: 5px;
}
.navbar .btn-group .btn {
margin-top: 0;
margin: 0;
}
.navbar-form {
margin-bottom: 0;
@ -3179,6 +3127,16 @@ input[type="submit"].btn.btn-mini {
text-decoration: none;
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 {
background-color: transparent;
color: #ffffff;
@ -3202,6 +3160,58 @@ input[type="submit"].btn.btn-mini {
margin-left: 10px;
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 {
content: '';
display: inline-block;
@ -3236,35 +3246,35 @@ input[type="submit"].btn.btn-mini {
bottom: -6px;
top: auto;
}
.navbar .nav .dropdown-toggle .caret,
.navbar .nav .open .caret {
.navbar .nav li.dropdown .dropdown-toggle .caret,
.navbar .nav li.dropdown.open .caret {
border-top-color: #ffffff;
border-bottom-color: #ffffff;
}
.navbar .nav .active .caret {
.navbar .nav li.dropdown.active .caret {
opacity: 1;
filter: alpha(opacity=100);
}
.navbar .nav .open > .dropdown-toggle,
.navbar .nav .active > .dropdown-toggle,
.navbar .nav .open.active > .dropdown-toggle {
.navbar .nav li.dropdown.open > .dropdown-toggle,
.navbar .nav li.dropdown.active > .dropdown-toggle,
.navbar .nav li.dropdown.open.active > .dropdown-toggle {
background-color: transparent;
}
.navbar .nav .active > .dropdown-toggle:hover {
.navbar .nav li.dropdown.active > .dropdown-toggle:hover {
color: #ffffff;
}
.navbar .nav.pull-right .dropdown-menu,
.navbar .nav .dropdown-menu.pull-right {
.navbar .pull-right .dropdown-menu,
.navbar .dropdown-menu.pull-right {
left: auto;
right: 0;
}
.navbar .nav.pull-right .dropdown-menu:before,
.navbar .nav .dropdown-menu.pull-right:before {
.navbar .pull-right .dropdown-menu:before,
.navbar .dropdown-menu.pull-right:before {
left: auto;
right: 12px;
}
.navbar .nav.pull-right .dropdown-menu:after,
.navbar .nav .dropdown-menu.pull-right:after {
.navbar .pull-right .dropdown-menu:after,
.navbar .dropdown-menu.pull-right:after {
left: auto;
right: 13px;
}

View file

@ -44,13 +44,23 @@
<span class="icon-bar"></span>
</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">
<ul class="nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
<p class="navbar-text pull-right">Logged in as <a class="navbar-link" href="#">username</a></p>
</div><!--/.nav-collapse -->
</div>
</div>

View file

@ -30,27 +30,6 @@
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
.nav-collapse.collapse {
height: auto;
@ -95,7 +74,7 @@
.navbarVerticalAlign(30px); // Vertically center in navbar
}
.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-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
.navbar .nav > li > a:hover {
background-color: @navbarLinkBackgroundHover; // "transparent" is default to differentiate :hover from .active
@ -264,6 +258,28 @@
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
@ -310,31 +326,31 @@
}
}
// Dropdown toggle caret
.navbar .nav .dropdown-toggle .caret,
.navbar .nav .open .caret {
.navbar .nav li.dropdown .dropdown-toggle .caret,
.navbar .nav li.dropdown.open .caret {
border-top-color: @white;
border-bottom-color: @white;
}
.navbar .nav .active .caret {
.navbar .nav li.dropdown.active .caret {
.opacity(100);
}
// Remove background color from open dropdown
.navbar .nav .open > .dropdown-toggle,
.navbar .nav .active > .dropdown-toggle,
.navbar .nav .open.active > .dropdown-toggle {
.navbar .nav li.dropdown.open > .dropdown-toggle,
.navbar .nav li.dropdown.active > .dropdown-toggle,
.navbar .nav li.dropdown.open.active > .dropdown-toggle {
background-color: transparent;
}
// Dropdown link on hover
.navbar .nav .active > .dropdown-toggle:hover {
.navbar .nav li.dropdown.active > .dropdown-toggle:hover {
color: @white;
}
// Right aligned menus need alt position
// TODO: rejigger this at some point to simplify the selectors
.navbar .nav.pull-right .dropdown-menu,
.navbar .nav .dropdown-menu.pull-right {
.navbar .pull-right .dropdown-menu,
.navbar .dropdown-menu.pull-right {
left: auto;
right: 0;
&:before {

View file

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

View file

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