mirror of
https://github.com/twbs/bootstrap.git
synced 2024-12-01 13:24:25 +01:00
Rework navbar padding and margins for right aligned last-child elements
This slight reworking of the navbar spacing was brought about by a problem noted in #11530: use of `.navbar-form.navbar-right` leaves an extra 15px of space on the right. Here’s what’s new: * Removed the `padding` on `.navbar-collapse` within static top, fixed top, and fixed bottom navbars. Meaning, it’s still there for the default navbar. This was the root cause of the extra 15px padding for navbar forms. * As part of this, I also replaced the existing negative margin overrides for last-child elements with more contextual ones within their sub-components. Overall not too different, but should be more effective now and easier to work with now. For example of new changes, see http://jsbin.com/odeSiSo/1/.
This commit is contained in:
parent
25bc5322aa
commit
5a0365524d
22
dist/css/bootstrap.css
vendored
22
dist/css/bootstrap.css
vendored
@ -4426,14 +4426,11 @@ textarea.input-group-sm > .input-group-btn > .btn {
|
||||
.navbar-collapse.in {
|
||||
overflow-y: auto;
|
||||
}
|
||||
.navbar-collapse .navbar-nav.navbar-left:first-child {
|
||||
margin-left: -15px;
|
||||
}
|
||||
.navbar-collapse .navbar-nav.navbar-right:last-child {
|
||||
margin-right: -15px;
|
||||
}
|
||||
.navbar-collapse .navbar-text:last-child {
|
||||
margin-right: 0;
|
||||
.navbar-fixed-top .navbar-collapse,
|
||||
.navbar-static-top .navbar-collapse,
|
||||
.navbar-fixed-bottom .navbar-collapse {
|
||||
padding-right: 0;
|
||||
padding-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4581,6 +4578,9 @@ textarea.input-group-sm > .input-group-btn > .btn {
|
||||
padding-top: 15px;
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
.navbar-nav.navbar-right:last-child {
|
||||
margin-right: -15px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
@ -4647,6 +4647,9 @@ textarea.input-group-sm > .input-group-btn > .btn {
|
||||
-webkit-box-shadow: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
.navbar-form.navbar-right:last-child {
|
||||
margin-right: -15px;
|
||||
}
|
||||
}
|
||||
|
||||
.navbar-nav > li > .dropdown-menu {
|
||||
@ -4692,6 +4695,9 @@ textarea.input-group-sm > .input-group-btn > .btn {
|
||||
margin-right: 15px;
|
||||
margin-left: 15px;
|
||||
}
|
||||
.navbar-text.navbar-right:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.navbar-default {
|
||||
|
2
dist/css/bootstrap.min.css
vendored
2
dist/css/bootstrap.min.css
vendored
File diff suppressed because one or more lines are too long
@ -77,15 +77,13 @@
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
// Account for first and last children spacing
|
||||
.navbar-nav.navbar-left:first-child {
|
||||
margin-left: -@navbar-padding-horizontal;
|
||||
}
|
||||
.navbar-nav.navbar-right:last-child {
|
||||
margin-right: -@navbar-padding-horizontal;
|
||||
}
|
||||
.navbar-text:last-child {
|
||||
margin-right: 0;
|
||||
// Undo the collapse side padding for navbars with containers to ensure
|
||||
// alignment of right-aligned contents.
|
||||
.navbar-fixed-top &,
|
||||
.navbar-static-top &,
|
||||
.navbar-fixed-bottom & {
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -251,8 +249,11 @@
|
||||
padding-bottom: @navbar-padding-vertical;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.navbar-right:last-child {
|
||||
margin-right: -@navbar-padding-horizontal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -303,6 +304,11 @@
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
.box-shadow(none);
|
||||
|
||||
// Outdent the form if last child to line up with content down the page
|
||||
&.navbar-right:last-child {
|
||||
margin-right: -@navbar-padding-horizontal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -354,6 +360,11 @@
|
||||
float: left;
|
||||
margin-left: @navbar-padding-horizontal;
|
||||
margin-right: @navbar-padding-horizontal;
|
||||
|
||||
// Outdent the form if last child to line up with content down the page
|
||||
&.navbar-right:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user