mirror of
https://github.com/twbs/bootstrap.git
synced 2024-11-29 11:24:18 +01:00
* #20936 make inline checkbox/radio markup same as stacked * tweak language and remove extra blank line in snippet
This commit is contained in:
parent
af937836d9
commit
8250bd1b21
@ -152,8 +152,7 @@ Below is a complete list of the specific form controls supported by Bootstrap an
|
||||
<tr>
|
||||
<td class="text-nowrap">
|
||||
{% markdown %}
|
||||
`.form-check`<br>
|
||||
`.form-check-inline`
|
||||
`.form-check`
|
||||
{% endmarkdown %}
|
||||
</td>
|
||||
<td class="text-nowrap">
|
||||
@ -463,30 +462,42 @@ By default, any number of checkboxes and radios that are immediate sibling will
|
||||
|
||||
### Inline
|
||||
|
||||
Groups of checkboxes or radios that appear on the same horizontal row are similar to their stacked counterparts, but require different HTML and a single class. To switch from stacked to inline, drop the surrounding `<div>`, add `.form-check-inline` to the `<label>`, and keep the `.form-check-input` on the `<input>`.
|
||||
Group checkboxes or radios on the same horizontal row by adding `.form-check-inline` to any `.form-check`.
|
||||
|
||||
{% example html %}
|
||||
<label class="form-check-inline">
|
||||
<div class="form-check form-check-inline">
|
||||
<label class="form-check-label">
|
||||
<input class="form-check-input" type="checkbox" id="inlineCheckbox1" value="option1"> 1
|
||||
</label>
|
||||
<label class="form-check-inline">
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<label class="form-check-label">
|
||||
<input class="form-check-input" type="checkbox" id="inlineCheckbox2" value="option2"> 2
|
||||
</label>
|
||||
<label class="form-check-inline">
|
||||
<input class="form-check-input" type="checkbox" id="inlineCheckbox3" value="option3"> 3
|
||||
</label>
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline disabled">
|
||||
<label class="form-check-label">
|
||||
<input class="form-check-input" type="checkbox" id="inlineCheckbox3" value="option3" disabled> 3
|
||||
</label>
|
||||
</div>
|
||||
{% endexample %}
|
||||
|
||||
{% example html %}
|
||||
<label class="form-check-inline">
|
||||
<div class="form-check form-check-inline">
|
||||
<label class="form-check-label">
|
||||
<input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio1" value="option1"> 1
|
||||
</label>
|
||||
<label class="form-check-inline">
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<label class="form-check-label">
|
||||
<input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio2" value="option2"> 2
|
||||
</label>
|
||||
<label class="form-check-inline">
|
||||
<input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio3" value="option3"> 3
|
||||
</label>
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline disabled">
|
||||
<label class="form-check-label">
|
||||
<input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio3" value="option3" disabled> 3
|
||||
</label>
|
||||
</div>
|
||||
{% endexample %}
|
||||
|
||||
### Without labels
|
||||
|
@ -235,21 +235,15 @@ select.form-control-lg {
|
||||
|
||||
// Radios and checkboxes on same line
|
||||
.form-check-inline {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
padding-left: 1.25rem;
|
||||
margin-bottom: 0; // Override default `<label>` bottom margin
|
||||
|
||||
.form-check-label {
|
||||
vertical-align: middle;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
+ .form-check-inline {
|
||||
margin-left: .75rem;
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
color: $text-muted;
|
||||
cursor: $cursor-disabled;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
.form-control-label,
|
||||
.col-form-label,
|
||||
.form-check-label,
|
||||
.form-check-inline,
|
||||
.custom-control {
|
||||
color: $color;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user