Bootstrap provides several form control styles, layout options, and custom components for creating a wide variety of forms.
Here are examples of .form-control applied to each textual HTML5 <input>
type.
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.
Use the .form-inline class to display a series of labels, form
controls, and buttons on a single horizontal row. Form controls within inline forms vary slightly from their
default states.
Visible labels
Custom form controls and selects are also supported.
For more structured form layouts that are also responsive, you can utilize Bootstrap’s predefined
grid classes or mixins to create horizontal forms. Add the
.row class to form groups and use the .col-*-*
classes to specify the width of your labels and controls.
Default checkboxes and radios are improved upon with the help of .form-check,
a single class for both input types that improves the layout and behavior of their HTML elements.
Checkboxes are for selecting one or several options in a list, while radios are for selecting one option from
many.
Default (stacked)
Inline
When you need to place plain text next to a form label within a form, use the .form-control-static
class on an element of your choice.
Add the disabled boolean attribute on an input to prevent user
interactions. Disabled inputs appear lighter and add a not-allowed
cursor.
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.
Set heights using classes like .form-control-lg, and set widths using
grid column classes like .col-lg-*.
Column sizing
Wrap inputs in grid columns, or any custom parent element, to easily enforce desired widths.
Block-level help text in forms can be created using .form-text
(previously known as .help-block in v3). Inline help text can be
flexibly implemented using any inline HTML element and utility classes like .text-muted.
Block level
Your password must be 8-20 characters long, contain letters and numbers, and must not contain spaces, special characters, or emoji.
Inline
Bootstrap includes validation styles for danger, warning, and success states on most form controls.
Those same states can also be used with horizontal forms.
Checkboxes and radios are also supported.
For even more customization and cross browser consistency, use our completely custom form elements to replace the browser defaults. They’re built on top of semantic and accessible markup, so they’re solid replacements for any default form control.
Checkboxes
Radios
Disabled
Validation states
Stacked
Select menu
File browser