@@ -19,7 +19,7 @@ Wrap a series of buttons with `.btn` in `.btn-group`. Add on optional JavaScript
...
@@ -19,7 +19,7 @@ Wrap a series of buttons with `.btn` in `.btn-group`. Add on optional JavaScript
{% endexample %}
{% endexample %}
{% callout warning %}
{% callout warning %}
#### Ensure correct `role` and provide a label
##### Ensure correct `role` and provide a label
In order for assistive technologies (such as screen readers) to convey that a series of buttons is grouped, an appropriate `role` attribute needs to be provided. For button groups, this would be `role="group"`, while toolbars should have a `role="toolbar"`.
In order for assistive technologies (such as screen readers) to convey that a series of buttons is grouped, an appropriate `role` attribute needs to be provided. For button groups, this would be `role="group"`, while toolbars should have a `role="toolbar"`.
@@ -95,7 +95,7 @@ Disabled buttons using the `<a>` element behave a bit different:
...
@@ -95,7 +95,7 @@ Disabled buttons using the `<a>` element behave a bit different:
{% endexample %}
{% endexample %}
{% callout warning %}
{% callout warning %}
#### Link functionality caveat
##### Link functionality caveat
The `.disabled` class uses `pointer-events: none` to try to disable the link functionality of `<a>`s, but that CSS property is not yet standardized. In addition, even in browsers that do support `pointer-events: none`, keyboard navigation remains unaffected, meaning that sighted keyboard users and users of assistive technologies will still be able to activate these links. So to be safe, add a `tabindex="-1"` attribute on these links (to prevent them from receiving keyboard focus) and use custom JavaScript to disable their functionality.
The `.disabled` class uses `pointer-events: none` to try to disable the link functionality of `<a>`s, but that CSS property is not yet standardized. In addition, even in browsers that do support `pointer-events: none`, keyboard navigation remains unaffected, meaning that sighted keyboard users and users of assistive technologies will still be able to activate these links. So to be safe, add a `tabindex="-1"` attribute on these links (to prevent them from receiving keyboard focus) and use custom JavaScript to disable their functionality.
<pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
<pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
<pclass="card-text"><smallclass="text-muted">Last updated 3 mins ago</small></p>
<pclass="card-text"><smallclass="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
</div>
</div>
<divclass="card">
<divclass="card">
<divclass="card-body">
<divclass="card-body">
<h4class="card-title">Card title</h4>
<h5class="card-title">Card title</h5>
<pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
<pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
<pclass="card-text"><smallclass="text-muted">Last updated 3 mins ago</small></p>
<pclass="card-text"><smallclass="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
...
@@ -366,7 +366,7 @@ Turn an image into a card background and overlay your card's text. Depending on
...
@@ -366,7 +366,7 @@ Turn an image into a card background and overlay your card's text. Depending on
<pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
<pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
<pclass="card-text">Last updated 3 mins ago</p>
<pclass="card-text">Last updated 3 mins ago</p>
</div>
</div>
...
@@ -386,7 +386,7 @@ Use [text and background utilities]({{ site.baseurl }}/docs/{{ site.docs_version
...
@@ -386,7 +386,7 @@ Use [text and background utilities]({{ site.baseurl }}/docs/{{ site.docs_version
<pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
<pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
<pclass="card-text"><smallclass="text-muted">Last updated 3 mins ago</small></p>
<pclass="card-text"><smallclass="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
...
@@ -446,7 +446,7 @@ Use card groups to render cards as a single, attached element with equal width a
...
@@ -446,7 +446,7 @@ Use card groups to render cards as a single, attached element with equal width a
<pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p>
<pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p>
<pclass="card-text"><smallclass="text-muted">Last updated 3 mins ago</small></p>
<pclass="card-text"><smallclass="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
...
@@ -469,7 +469,7 @@ When using card groups with footers, their content will automatically line up.
...
@@ -469,7 +469,7 @@ When using card groups with footers, their content will automatically line up.
<pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
<pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
</div>
</div>
<divclass="card-footer">
<divclass="card-footer">
...
@@ -479,7 +479,7 @@ When using card groups with footers, their content will automatically line up.
...
@@ -479,7 +479,7 @@ When using card groups with footers, their content will automatically line up.
<pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p>
<pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p>
</div>
</div>
<divclass="card-footer">
<divclass="card-footer">
...
@@ -508,7 +508,7 @@ Need a set of equal width and height cards that aren't attached to one another?
...
@@ -508,7 +508,7 @@ Need a set of equal width and height cards that aren't attached to one another?
<pclass="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
<pclass="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
<pclass="card-text"><smallclass="text-muted">Last updated 3 mins ago</small></p>
<pclass="card-text"><smallclass="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
...
@@ -516,7 +516,7 @@ Need a set of equal width and height cards that aren't attached to one another?
...
@@ -516,7 +516,7 @@ Need a set of equal width and height cards that aren't attached to one another?
<pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p>
<pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p>
<pclass="card-text"><smallclass="text-muted">Last updated 3 mins ago</small></p>
<pclass="card-text"><smallclass="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
...
@@ -539,7 +539,7 @@ Just like with card groups, card footers in decks will automatically line up.
...
@@ -539,7 +539,7 @@ Just like with card groups, card footers in decks will automatically line up.
<pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
<pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
</div>
</div>
<divclass="card-footer">
<divclass="card-footer">
...
@@ -549,7 +549,7 @@ Just like with card groups, card footers in decks will automatically line up.
...
@@ -549,7 +549,7 @@ Just like with card groups, card footers in decks will automatically line up.
<pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p>
<pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p>
</div>
</div>
<divclass="card-footer">
<divclass="card-footer">
...
@@ -580,7 +580,7 @@ Cards can be organized into [Masonry](https://masonry.desandro.com/)-like column
...
@@ -580,7 +580,7 @@ Cards can be organized into [Masonry](https://masonry.desandro.com/)-like column
<h4class="card-title">Card title that wraps to a new line</h4>
<h5class="card-title">Card title that wraps to a new line</h5>
<pclass="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
<pclass="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
</div>
</div>
</div>
</div>
...
@@ -597,7 +597,7 @@ Cards can be organized into [Masonry](https://masonry.desandro.com/)-like column
...
@@ -597,7 +597,7 @@ Cards can be organized into [Masonry](https://masonry.desandro.com/)-like column
<pclass="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
<pclass="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
<pclass="card-text"><smallclass="text-muted">Last updated 3 mins ago</small></p>
<pclass="card-text"><smallclass="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
...
@@ -614,7 +614,7 @@ Cards can be organized into [Masonry](https://masonry.desandro.com/)-like column
...
@@ -614,7 +614,7 @@ Cards can be organized into [Masonry](https://masonry.desandro.com/)-like column
</div>
</div>
<divclass="card text-center">
<divclass="card text-center">
<divclass="card-body">
<divclass="card-body">
<h4class="card-title">Card title</h4>
<h5class="card-title">Card title</h5>
<pclass="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
<pclass="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
<pclass="card-text"><smallclass="text-muted">Last updated 3 mins ago</small></p>
<pclass="card-text"><smallclass="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
...
@@ -634,7 +634,7 @@ Cards can be organized into [Masonry](https://masonry.desandro.com/)-like column
...
@@ -634,7 +634,7 @@ Cards can be organized into [Masonry](https://masonry.desandro.com/)-like column
</div>
</div>
<divclass="card">
<divclass="card">
<divclass="card-body">
<divclass="card-body">
<h4class="card-title">Card title</h4>
<h5class="card-title">Card title</h5>
<pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p>
<pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p>
<pclass="card-text"><smallclass="text-muted">Last updated 3 mins ago</small></p>
<pclass="card-text"><smallclass="text-muted">Last updated 3 mins ago</small></p>
@@ -249,7 +249,7 @@ Since Bootstrap applies `display: block` and `width: 100%` to almost all our for
...
@@ -249,7 +249,7 @@ Since Bootstrap applies `display: block` and `width: 100%` to almost all our for
### Form groups
### Form groups
The `.form-group` class is the easiest way to add some structure to forms. Its only purpose is to provide `margin-bottom` around a label and control pairing. As a bonus, since it's a class you can use it with `<fieldset>`s, `<div>`s, or nearly any other element.
The `.form-group` class is the easiest way to add some structure to forms. It provides a flexible class that encourages proper grouping of labels, controls, optional help text, and form validation messaging. By default it only applies `margin-bottom`, but it picks up additional styles in `.form-inline` as needed. Use it with `<fieldset>`s, `<div>`s, or nearly any other element.
{% example html %}
{% example html %}
<form>
<form>
...
@@ -611,7 +611,7 @@ Custom form controls and selects are also supported.
...
@@ -611,7 +611,7 @@ Custom form controls and selects are also supported.
{% endexample %}
{% endexample %}
{% callout warning %}
{% callout warning %}
#### Alternatives to hidden labels
##### Alternatives to hidden labels
Assistive technologies such as 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 `.sr-only` class. There are further alternative methods of providing a label for assistive technologies, such as the `aria-label`, `aria-labelledby` or `title` attribute. If none of these are present, assistive technologies may resort to using the `placeholder` attribute, if present, but note that use of `placeholder` as a replacement for other labelling methods is not advised.
Assistive technologies such as 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 `.sr-only` class. There are further alternative methods of providing a label for assistive technologies, such as the `aria-label`, `aria-labelledby` or `title` attribute. If none of these are present, assistive technologies may resort to using the `placeholder` attribute, if present, but note that use of `placeholder` as a replacement for other labelling methods is not advised.
{% endcallout %}
{% endcallout %}
...
@@ -684,7 +684,7 @@ Add the `disabled` attribute to a `<fieldset>` to disable all the controls withi
...
@@ -684,7 +684,7 @@ Add the `disabled` attribute to a `<fieldset>` to disable all the controls withi
{% endexample %}
{% endexample %}
{% callout warning %}
{% callout warning %}
#### Caveat with anchors
##### Caveat with anchors
By default, browsers will treat all native form controls (`<input>`, `<select>` and `<button>` elements) inside a `<fieldset disabled>` as disabled, preventing both keyboard and mouse interactions on them. However, if your form also includes `<a ... class="btn btn-*">` elements, these will only be given a style of `pointer-events: none`. As noted in the section about [disabled state for buttons]({{ site.baseurl }}/docs/{{ site.docs_version }}/components/buttons/#disabled-state) (and specifically in the sub-section for anchor elements), this CSS property is not yet standardized and isn't fully supported in Opera 18 and below, or in Internet Explorer 10, and won't prevent keyboard users from being able to focus or activate these links. So to be safe, use custom JavaScript to disable such links.
By default, browsers will treat all native form controls (`<input>`, `<select>` and `<button>` elements) inside a `<fieldset disabled>` as disabled, preventing both keyboard and mouse interactions on them. However, if your form also includes `<a ... class="btn btn-*">` elements, these will only be given a style of `pointer-events: none`. As noted in the section about [disabled state for buttons]({{ site.baseurl }}/docs/{{ site.docs_version }}/components/buttons/#disabled-state) (and specifically in the sub-section for anchor elements), this CSS property is not yet standardized and isn't fully supported in Opera 18 and below, or in Internet Explorer 10, and won't prevent keyboard users from being able to focus or activate these links. So to be safe, use custom JavaScript to disable such links.
The required markup for a tooltip is only a `data` attribute and `title` on the HTML element you wish to have a tooltip. The generated markup of a tooltip is rather simple, though it does require a position (by default, set to `top` by the plugin).
The required markup for a tooltip is only a `data` attribute and `title` on the HTML element you wish to have a tooltip. The generated markup of a tooltip is rather simple, though it does require a position (by default, set to `top` by the plugin).
{% callout warning %}
{% callout warning %}
#### Making tooltips work for keyboard and assistive technology users
##### Making tooltips work for keyboard and assistive technology users
You should only add tooltips to HTML elements that are traditionally keyboard-focusable and interactive (such as links or form controls). Although arbitrary HTML elements (such as `<span>`s) can be made focusable by adding the `tabindex="0"` attribute, this will add potentially annoying and confusing tab stops on non-interactive elements for keyboard users. In addition, most assistive technologies currently do not announce the tooltip in this situation.
You should only add tooltips to HTML elements that are traditionally keyboard-focusable and interactive (such as links or form controls). Although arbitrary HTML elements (such as `<span>`s) can be made focusable by adding the `tabindex="0"` attribute, this will add potentially annoying and confusing tab stops on non-interactive elements for keyboard users. In addition, most assistive technologies currently do not announce the tooltip in this situation.
@@ -19,7 +19,7 @@ Images in Bootstrap are made responsive with `.img-fluid`. `max-width: 100%;` an
...
@@ -19,7 +19,7 @@ Images in Bootstrap are made responsive with `.img-fluid`. `max-width: 100%;` an
{% endhighlight %}
{% endhighlight %}
{% callout warning %}
{% callout warning %}
#### SVG images and IE 10
##### SVG images and IE 10
In Internet Explorer 10, SVG images with `.img-fluid` are disproportionately sized. To fix this, add `width: 100% \9;` where necessary. This fix improperly sizes other image formats, so Bootstrap doesn't apply it automatically.
In Internet Explorer 10, SVG images with `.img-fluid` are disproportionately sized. To fix this, add `width: 100% \9;` where necessary. This fix improperly sizes other image formats, so Bootstrap doesn't apply it automatically.
@@ -342,7 +342,7 @@ HTML5 adds [a new global attribute named `[hidden]`](https://developer.mozilla.o
...
@@ -342,7 +342,7 @@ HTML5 adds [a new global attribute named `[hidden]`](https://developer.mozilla.o
{% endhighlight %}
{% endhighlight %}
{% callout warning %}
{% callout warning %}
#### jQuery incompatibility
##### jQuery incompatibility
`[hidden]` is not compatible with jQuery's `$(...).hide()` and `$(...).show()` methods. Therefore, we don't currently especially endorse `[hidden]` over other techniques for managing the `display` of elements.
`[hidden]` is not compatible with jQuery's `$(...).hide()` and `$(...).show()` methods. Therefore, we don't currently especially endorse `[hidden]` over other techniques for managing the `display` of elements.
Bootstrap's plugins don't fall back particularly gracefully when JavaScript is disabled. If you care about the user experience in this case, use [`<noscript>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/noscript) to explain the situation (and how to re-enable JavaScript) to your users, and/or add your own custom fallbacks.
Bootstrap's plugins don't fall back particularly gracefully when JavaScript is disabled. If you care about the user experience in this case, use [`<noscript>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/noscript) to explain the situation (and how to re-enable JavaScript) to your users, and/or add your own custom fallbacks.
{% callout warning %}
{% callout warning %}
#### Third-party libraries
##### Third-party libraries
**Bootstrap does not officially support third-party JavaScript libraries** like Prototype or jQuery UI. Despite `.noConflict` and namespaced events, there may be compatibility problems that you need to fix on your own.
**Bootstrap does not officially support third-party JavaScript libraries** like Prototype or jQuery UI. Despite `.noConflict` and namespaced events, there may be compatibility problems that you need to fix on your own.