aboutsummaryrefslogtreecommitdiff
path: root/less
diff options
context:
space:
mode:
authorMark Otto <[email protected]>2013-08-13 15:19:59 -0700
committerMark Otto <[email protected]>2013-08-13 15:19:59 -0700
commitfa330f308aace22886fee3dbacbcbd4f8adb0fe6 (patch)
tree1fc9ae613e1077d48e98a841e5bcf95e805ef0fc /less
parent8d2948c0d6d5b9f753e917aa36fe43549e696e97 (diff)
downloadbootstrap-fa330f308aace22886fee3dbacbcbd4f8adb0fe6.tar.xz
bootstrap-fa330f308aace22886fee3dbacbcbd4f8adb0fe6.zip
Overhaul navbar alignment (.pull-) utilities (fixes #9440)
Now navbars have their own float utility classes, mixin-ed versions of `.pull-left` and `.pull-right`. * Removed chained `.navbar-nav.pull-right` * Added `.navbar-left` and `.navbar-right` as mixins of the default float utilities, but only above the `@grid-float-breakpoint` to match the new navbar behavior * Updated components docs to match the new changeas * Added callout about component alignment here to explain the new classes
Diffstat (limited to 'less')
-rw-r--r--less/navbar.less30
1 files changed, 19 insertions, 11 deletions
diff --git a/less/navbar.less b/less/navbar.less
index 522569329..287ef603c 100644
--- a/less/navbar.less
+++ b/less/navbar.less
@@ -205,12 +205,6 @@
}
}
- // Right aligned contents
- // Make them full width first so that they align properly on mobile
- &.pull-right {
- width: 100%;
- }
-
@media (max-width: @screen-phone-max) {
// Dropdowns get custom display
.open .dropdown-menu {
@@ -257,13 +251,26 @@
}
+// Component alignment
+//
+// Repurpose the pull utilities as their own navbar utilities to avoid specifity
+// issues with parents and chaining. Only do this when the navbar is uncollapsed
+// though so that navbar contents properly stack and align in mobile.
+
+@media (min-width: @grid-float-breakpoint) {
+ .navbar-left { .pull-left(); }
+ .navbar-right { .pull-right(); }
+}
+
+
// Navbar form
//
// Extension of the `.form-inline` with some extra flavor for optimum display in
// our navbars.
.navbar-form {
- width: 100%; // Counteract the float from `.pull-` classes
+ margin-left: -@navbar-padding-horizontal;
+ margin-right: -@navbar-padding-horizontal;
padding: 10px @navbar-padding-horizontal;
border-top: 1px solid darken(@navbar-bg, 7%);
border-bottom: 1px solid darken(@navbar-bg, 7%);
@@ -284,6 +291,8 @@
@media (min-width: @grid-float-breakpoint) {
width: auto;
border: 0;
+ margin-left: 0;
+ margin-right: 0;
padding-top: 0;
padding-bottom: 0;
}
@@ -435,6 +444,9 @@
@media (max-width: @screen-phone-max) {
// Dropdowns get custom display
.open .dropdown-menu {
+ > .dropdown-header {
+ border-color: @navbar-inverse-border;
+ }
> li > a {
color: @navbar-inverse-link-color;
&:hover,
@@ -485,10 +497,6 @@
padding-bottom: ((@navbar-height - @line-height-computed) / 2);
}
}
-
- &.pull-right {
- width: auto;
- }
}
// Required to make the collapsing navbar work on regular desktops