` to disable all the controls within.
{% example html %}
{% endexample %}
Caveat about link functionality of `<a>`
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 (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 11, 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.
Cross-browser compatibility
While Bootstrap will apply these styles in all browsers, Internet Explorer 11 and below don't fully support the disabled
attribute on a <fieldset>
. Use custom JavaScript to disable the fieldset in these browsers.
## Readonly inputs
Add the `readonly` boolean attribute on an input to prevent modification of the input's value. Read-only inputs appear lighter (just like disabled inputs), but retain the standard cursor.<
{% example html %}
{% endexample %}
## Validation
Bootstrap includes validation styles for error, warning, and success states on form controls. To use, add `.has-warning`, `.has-error`, or `.has-success` to the parent element. Any `.control-label`, `.form-control`, and `.help-block` within that element will receive the validation styles.
{% example html %}
Input with success
Input with warning
Input with error
{% endexample %}
You can also add optional feedback icons with the addition of `.has-feedback` and the right icon.
Icons, labels, and input groups
Manual positioning of feedback icons is required for inputs without a label and for input groups with an add-on on the right. You are strongly encouraged to provide labels for all inputs for accessibility reasons. If you wish to prevent labels from being displayed, hide them with the `sr-only` class. If you must do without labels, adjust the `top` value of the feedback icon. For input groups, adjust the `right` value to an appropriate pixel value depending on the width of your addon.
{% example html %}
Input with success
(success)
Input with warning
(warning)
Input with error
(error)
{% endexample %}
{% example html %}
{% endexample %}
{% example html %}
{% endexample %}
{% example html %}
{% endexample %}
For form controls with no visible label, add the `.sr-only` class on the label. Bootstrap will automatically adjust the position of the icon once it's been added.
{% example html %}
Hidden label
{% endexample %}
## Control sizing
Set heights using classes like `.input-lg`, and set widths using grid column classes like `.col-lg-*`.
{% example html %}
{% endexample %}
Quickly size labels and form controls within `.form-horizontal` by adding `.form-group-lg` or `.form-group-sm` to existing `.form-group`s.
{% example html %}
{% endexample %}
## Column sizing
Wrap inputs in grid columns, or any custom parent element, to easily enforce desired widths.
{% example html %}
{% endexample %}
## Help text
Block level help text for form controls.
{% example html %}
A block of help text that breaks onto a new line and may extend beyond one line.
{% endexample %}