mirror of
https://github.com/twbs/bootstrap.git
synced 2025-01-17 09:52:29 +01:00
fixes #9382: inline forms now require use of .form-group for proper alignment of all form controls
This commit is contained in:
parent
a9a27d3794
commit
f662dff6e9
@ -437,11 +437,6 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Forms */
|
/* Forms */
|
||||||
.bs-example.form-inline select,
|
|
||||||
.bs-example.form-inline input[type="text"],
|
|
||||||
.bs-example.form-inline input[type="password"] {
|
|
||||||
width: 180px;
|
|
||||||
}
|
|
||||||
.bs-example-control-sizing select,
|
.bs-example-control-sizing select,
|
||||||
.bs-example-control-sizing input[type="text"] + input[type="text"] {
|
.bs-example-control-sizing input[type="text"] + input[type="text"] {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
|
24
css.html
24
css.html
@ -1394,10 +1394,14 @@ For example, <code><section></code> should be wrapped as inline.
|
|||||||
<p>Screen readers will have trouble with your forms if you don't include a label for every input. For these inline forms, you can hide the labels using the <code>.sr-only</code> class.</p>
|
<p>Screen readers will have trouble with your forms if you don't include a label for every input. For these inline forms, you can hide the labels using the <code>.sr-only</code> class.</p>
|
||||||
</div>
|
</div>
|
||||||
<form class="bs-example form-inline" role="form">
|
<form class="bs-example form-inline" role="form">
|
||||||
<label class="sr-only" for="exampleInputEmail">Email address</label>
|
<div class="form-group">
|
||||||
<input type="text" class="form-control" id="exampleInputEmail" placeholder="Enter email">
|
<label class="sr-only" for="exampleInputEmail">Email address</label>
|
||||||
<label class="sr-only" for="exampleInputPassword">Password</label>
|
<input type="text" class="form-control" id="exampleInputEmail" placeholder="Enter email">
|
||||||
<input type="password" class="form-control" id="exampleInputPassword" placeholder="Password">
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="sr-only" for="exampleInputPassword">Password</label>
|
||||||
|
<input type="password" class="form-control" id="exampleInputPassword" placeholder="Password">
|
||||||
|
</div>
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox"> Remember me
|
<input type="checkbox"> Remember me
|
||||||
@ -1407,10 +1411,14 @@ For example, <code><section></code> should be wrapped as inline.
|
|||||||
</form><!-- /example -->
|
</form><!-- /example -->
|
||||||
{% highlight html %}
|
{% highlight html %}
|
||||||
<form class="form-inline" role="form">
|
<form class="form-inline" role="form">
|
||||||
<label class="sr-only" for="exampleInputEmail">Email address</label>
|
<div class="form-group">
|
||||||
<input type="text" class="form-control" id="exampleInputEmail" placeholder="Enter email">
|
<label class="sr-only" for="exampleInputEmail">Email address</label>
|
||||||
<label class="sr-only" for="exampleInputPassword">Password</label>
|
<input type="text" class="form-control" id="exampleInputEmail" placeholder="Enter email">
|
||||||
<input type="password" class="form-control" id="exampleInputPassword" placeholder="Password">
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="sr-only" for="exampleInputPassword">Password</label>
|
||||||
|
<input type="password" class="form-control" id="exampleInputPassword" placeholder="Password">
|
||||||
|
</div>
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox"> Remember me
|
<input type="checkbox"> Remember me
|
||||||
|
77
dist/css/bootstrap.css
vendored
77
dist/css/bootstrap.css
vendored
@ -1823,23 +1823,27 @@ textarea.input-sm {
|
|||||||
color: #737373;
|
color: #737373;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-inline .form-control,
|
@media (min-width: 768px) {
|
||||||
.form-inline .radio,
|
.form-inline .form-group {
|
||||||
.form-inline .checkbox {
|
display: inline-block;
|
||||||
display: inline-block;
|
margin-bottom: 0;
|
||||||
}
|
vertical-align: middle;
|
||||||
|
}
|
||||||
.form-inline .radio,
|
.form-inline .form-control {
|
||||||
.form-inline .checkbox {
|
width: auto;
|
||||||
padding-left: 0;
|
}
|
||||||
margin-top: 0;
|
.form-inline .radio,
|
||||||
margin-bottom: 0;
|
.form-inline .checkbox {
|
||||||
}
|
display: inline-block;
|
||||||
|
padding-left: 0;
|
||||||
.form-inline .radio input[type="radio"],
|
margin-top: 0;
|
||||||
.form-inline .checkbox input[type="checkbox"] {
|
margin-bottom: 0;
|
||||||
float: none;
|
}
|
||||||
margin-left: 0;
|
.form-inline .radio input[type="radio"],
|
||||||
|
.form-inline .checkbox input[type="checkbox"] {
|
||||||
|
float: none;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-horizontal .control-label,
|
.form-horizontal .control-label,
|
||||||
@ -3148,23 +3152,27 @@ button.close {
|
|||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar-form .form-control,
|
@media (min-width: 768px) {
|
||||||
.navbar-form .radio,
|
.navbar-form .form-group {
|
||||||
.navbar-form .checkbox {
|
display: inline-block;
|
||||||
display: inline-block;
|
margin-bottom: 0;
|
||||||
}
|
vertical-align: middle;
|
||||||
|
}
|
||||||
.navbar-form .radio,
|
.navbar-form .form-control {
|
||||||
.navbar-form .checkbox {
|
width: auto;
|
||||||
padding-left: 0;
|
}
|
||||||
margin-top: 0;
|
.navbar-form .radio,
|
||||||
margin-bottom: 0;
|
.navbar-form .checkbox {
|
||||||
}
|
display: inline-block;
|
||||||
|
padding-left: 0;
|
||||||
.navbar-form .radio input[type="radio"],
|
margin-top: 0;
|
||||||
.navbar-form .checkbox input[type="checkbox"] {
|
margin-bottom: 0;
|
||||||
float: none;
|
}
|
||||||
margin-left: 0;
|
.navbar-form .radio input[type="radio"],
|
||||||
|
.navbar-form .checkbox input[type="checkbox"] {
|
||||||
|
float: none;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar-nav > li > .dropdown-menu {
|
.navbar-nav > li > .dropdown-menu {
|
||||||
@ -4712,7 +4720,6 @@ a.list-group-item.active > .badge,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 768px) {
|
@media screen and (min-width: 768px) {
|
||||||
.carousel-control .glyphicon,
|
|
||||||
.carousel-control .icon-prev,
|
.carousel-control .icon-prev,
|
||||||
.carousel-control .icon-next {
|
.carousel-control .icon-next {
|
||||||
width: 30px;
|
width: 30px;
|
||||||
|
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
@ -293,28 +293,44 @@ textarea {
|
|||||||
|
|
||||||
// Inline forms
|
// Inline forms
|
||||||
//
|
//
|
||||||
// Make forms appear inline(-block).
|
// Make forms appear inline(-block) by adding the `.form-inline` class. Inline
|
||||||
|
// forms begin stacked on extra small (mobile) devices and then go inline when
|
||||||
|
// viewports reach <768px.
|
||||||
|
//
|
||||||
|
// Requires wrapping inputs and labels with `.form-group` for proper display of
|
||||||
|
// default HTML form controls and our custom form controls (e.g., input groups).
|
||||||
|
|
||||||
.form-inline {
|
.form-inline {
|
||||||
.form-control,
|
|
||||||
.radio,
|
|
||||||
.checkbox {
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove default margin on radios/checkboxes that were used for stacking, and
|
// Kick in the inline
|
||||||
// then undo the floating of radios and checkboxes to match (which also avoids
|
@media (min-width: @screen-tablet) {
|
||||||
// a bug in WebKit: https://github.com/twbs/bootstrap/issues/1969).
|
// Inline-block all the things for "inline"
|
||||||
.radio,
|
.form-group {
|
||||||
.checkbox {
|
display: inline-block;
|
||||||
margin-top: 0;
|
margin-bottom: 0;
|
||||||
margin-bottom: 0;
|
vertical-align: middle;
|
||||||
padding-left: 0;
|
}
|
||||||
}
|
|
||||||
.radio input[type="radio"],
|
// Reset form control's default 100% width
|
||||||
.checkbox input[type="checkbox"] {
|
.form-control {
|
||||||
float: none;
|
width: auto;
|
||||||
margin-left: 0;
|
}
|
||||||
|
|
||||||
|
// Remove default margin on radios/checkboxes that were used for stacking, and
|
||||||
|
// then undo the floating of radios and checkboxes to match (which also avoids
|
||||||
|
// a bug in WebKit: https://github.com/twbs/bootstrap/issues/1969).
|
||||||
|
.radio,
|
||||||
|
.checkbox {
|
||||||
|
display: inline-block;
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 0;
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
.radio input[type="radio"],
|
||||||
|
.checkbox input[type="checkbox"] {
|
||||||
|
float: none;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user