Default styles

Individual form controls receive styling, but without any required base class on the <form> or large changes in markup. Results in stacked, left-aligned labels on top of form controls.

Legend Example block-level help text here.
  1. <form>
  2.  <legend>Legend</legend>
  3.  <label>Label name</label>
  4.  <input type=«text» placeholder=«Type something…»>
  5.  <span class=«help-block»>Example block-level help text here.</span>
  6.  <label class=«checkbox»>
  7.  <input type=«checkbox»> Check me out
  8.  </label>
  9.  <button type=«submit» class=«btn»>Submit</button>
  10. </form>

Optional layouts

Included with Bootstrap are three optional form layouts for common use cases.

Search form

Add .form-search to the form and .search-query to the <input> for an extra-rounded text input.

  1. <form class=«form-search»>
  2.  <input type=«text» class=«input-medium search-query»>
  3.  <button type=«submit» class=«btn»>Search</button>
  4. </form>

Inline form

Add .form-inline for left-aligned labels and inline-block controls for a compact layout.

  1. <form class=«form-inline»>
  2.  <input type=«text» class=«input-small» placeholder=«Email»>
  3.  <input type=«password» class=«input-small» placeholder=«Password»>
  4.  <label class=«checkbox»>
  5.  <input type=«checkbox»> Remember me
  6.  </label>
  7.  <button type=«submit» class=«btn»>Sign in</button>
  8. </form>

Horizontal form

Right align labels and float them to the left to make them appear on the same line as controls. Requires the most markup changes from a default form:

  • Add .form-horizontal to the form
  • Wrap labels and controls in .control-group
  • Add .control-label to the label
  • Wrap any associated controls in .controls for proper alignment

  1. <form class=«form-horizontal»>
  2.  <div class=«control-group»>
  3.  <label class=«control-label» for=«inputEmail»>Email</label>
  4.  <div class=«controls»>
  5.  <input type=«text» id=«inputEmail» placeholder=«Email»>
  6.  </div>
  7.  </div>
  8.  <div class=«control-group»>
  9.  <label class=«control-label» for=«inputPassword»>Password</label>
  10.  <div class=«controls»>
  11.  <input type=«password» id=«inputPassword» placeholder=«Password»>
  12.  </div>
  13.  </div>
  14.  <div class=«control-group»>
  15.  <div class=«controls»>
  16.  <label class=«checkbox»>
  17.  <input type=«checkbox»> Remember me
  18.  </label>
  19.  <button type=«submit» class=«btn»>Sign in</button>
  20.  </div>
  21.  </div>
  22. </form>

Supported form controls

Examples of standard form controls supported in an example form layout.


Most common form control, text-based input fields. Includes support for all HTML5 types: text, password, datetime, datetime-local, date, month, time, week, number, email, url, search, tel, and color.

Requires the use of a specified type at all times.

  1. <input type=«text» placeholder=«Text input»>


Form control which supports multiple lines of text. Change rows attribute as necessary.

  1. <textarea rows=«3»></textarea>

Checkboxes and radios

Checkboxes are for selecting one or several options in a list while radios are for selecting one option from many.

Default (stacked)

  1. <label class=«checkbox»>
  2.  <input type=«checkbox» value=«»>
  3. Option one is this and that—be sure to include why it’s great
  4. </label>
  6. <label class=«radio»>
  7.  <input type=«radio» name=«optionsRadios» id=«optionsRadios1» value=«option1» checked>
  8. Option one is this and that—be sure to include why it’s great
  9. </label>
  10. <label class=«radio»>
  11.  <input type=«radio» name=«optionsRadios» id=«optionsRadios2» value=«option2»>
  12. Option two can be something else and selecting it will deselect option one
  13. </label>

Inline checkboxes

Add the .inline class to a series of checkboxes or radios for controls appear on the same line.

  1. <label class=«checkbox inline»>
  2.  <input type=«checkbox» id=«inlineCheckbox1» value=«option1»> 1
  3. </label>
  4. <label class=«checkbox inline»>
  5.  <input type=«checkbox» id=«inlineCheckbox2» value=«option2»> 2
  6. </label>
  7. <label class=«checkbox inline»>
  8.  <input type=«checkbox» id=«inlineCheckbox3» value=«option3»> 3
  9. </label>


Use the default option or specify a multiple="multiple" to show multiple options at once.

  1. <select>
  2.  <option>1</option>
  3.  <option>2</option>
  4.  <option>3</option>
  5.  <option>4</option>
  6.  <option>5</option>
  7. </select>
  9. <select multiple=«multiple»>
  10.  <option>1</option>
  11.  <option>2</option>
  12.  <option>3</option>
  13.  <option>4</option>
  14.  <option>5</option>
  15. </select>

Extending form controls

Adding on top of existing browser controls, Bootstrap includes other useful form components.

Prepended and appended inputs

Add text or buttons before or after any text-based input. Do note that select elements are not supported here.

Default options

Wrap an .add-on and an input with one of two classes to prepend or append text to an input.



  1. <div class=«input-prepend»>
  2.  <span class=«add-on»>@</span><input class=«span2» id=«prependedInput» size=«16» type=«text» placeholder=«Username»>
  3. </div>
  4. <div class=«input-append»>
  5.  <input class=«span2» id=«appendedInput» size=«16» type=«text»><span class=«add-on»>.00</span>
  6. </div>


Use both classes and two instances of .add-on to prepend and append an input.

$ .00

  1. <div class=«input-prepend input-append»>
  2.  <span class=«add-on»>$</span><input class=«span2» id=«appendedPrependedInput» size=«16» type=«text»><span class=«add-on»>.00</span>
  3. </div>

Buttons instead of text

Instead of a <span> with text, use a .btn to attach a button (or two) to an input.

  1. <div class=«input-append»>
  2.  <input class=«span2» id=«appendedInputButton» size=«16» type=«text»><button class=«btn» type=«button»>Go!</button>
  3. </div>
  5. <div class=«input-append»>
  6.  <input class=«span2» id=«appendedInputButtons» size=«16» type=«text»><button class=«btn» type=«button»>Search</button><button class=«btn» type=«button»>Options</button>
  7. </div>

Search form

  1. <form class=«form-search»>
  2.  <div class=«input-append»>
  3.  <input type=«text» class=«span2 search-query»>
  4.  <button type=«submit» class=«btn»>Search</button>
  5.  </div>
  6.  <div class=«input-prepend»>
  7.  <button type=«submit» class=«btn»>Search</button>
  8.  <input type=«text» class=«span2 search-query»>
  9.  </div>
  10. </form>

Control sizing

Use relative sizing classes like .input-large or match your inputs to the grid column sizes using .span* classes.

Relative sizing

  1. <input class=«input-mini» type=«text» placeholder=«.input-mini»>
  2. <input class=«input-small» type=«text» placeholder=«.input-small»>
  3. <input class=«input-medium» type=«text» placeholder=«.input-medium»>
  4. <input class=«input-large» type=«text» placeholder=«.input-large»>
  5. <input class=«input-xlarge» type=«text» placeholder=«.input-xlarge»>
  6. <input class=«input-xxlarge» type=«text» placeholder=«.input-xxlarge»>

Heads up! In future versions, we’ll be altering the use of these relative input classes to match our button sizes. For example, .input-large will increase the padding and font-size of an input.

Grid sizing

Use .span1 to .span12 for inputs that match the same sizes of the grid columns.

  1. <input class=«span1» type=«text» placeholder=«.span1»>
  2. <input class=«span2» type=«text» placeholder=«.span2»>
  3. <input class=«span3» type=«text» placeholder=«.span3»>
  4. <select class=«span1»>
  5. </select>
  6. <select class=«span2»>
  7. </select>
  8. <select class=«span3»>
  9. </select>

For multiple grid inputs per line, use the .controls-row modifier class for proper spacing. It floats the inputs to collapse white-space, sets the proper margins, and the clears the float.

  1. <div class=«controls»>
  2.  <input class=«span5» type=«text» placeholder=«.span5»>
  3. </div>
  4. <div class=«controls controls-row»>
  5.  <input class=«span4» type=«text» placeholder=«.span4»>
  6.  <input class=«span1» type=«text» placeholder=«.span1»>
  7. </div>

Uneditable inputs

Present data in a form that’s not editable without using actual form markup.

Some value here
  1. <span class=«input-xlarge uneditable-input»>Some value here</span>

Form actions

End a form with a group of actions (buttons). When placed within a .form-horizontal, the buttons will automatically indent to line up with the form controls.

  1. <div class=«form-actions»>
  2.  <button type=«submit» class=«btn btn-primary»>Save changes</button>
  3.  <button type=«button» class=«btn»>Cancel</button>
  4. </div>

Help text

Inline and block level support for help text that appears around form controls.

Inline help

Inline help text
  1. <input type=«text»><span class=«help-inline»>Inline help text</span>

Block help

A longer block of help text that breaks onto a new line and may extend beyond one line.
  1. <input type=«text»><span class=«help-block»>A longer block of help text that breaks onto a new line and may extend beyond one line.</span>

Form control states

Provide feedback to users or visitors with basic feedback states on form controls and labels.

Input focus

We remove the default outline styles on some form controls and apply a box-shadow in its place for :focus.

  1. <input class=«input-xlarge» id=«focusedInput» type=«text» value=«This is focused…»>

Disabled inputs

Add the disabled attribute on an input to prevent user input and trigger a slightly different look.

  1. <input class=«input-xlarge» id=«disabledInput» type=«text» placeholder=«Disabled input here…» disabled>

Validation states

Bootstrap includes validation styles for error, warning, info, and success messages. To use, add the appropriate class to the surrounding .control-group.

Something may have gone wrong

Please correct the error

Username is taken


  1. <div class=«control-group warning»>
  2.  <label class=«control-label» for=«inputWarning»>Input with warning</label>
  3.  <div class=«controls»>
  4.  <input type=«text» id=«inputWarning»>
  5.  <span class=«help-inline»>Something may have gone wrong</span>
  6.  </div>
  7. </div>
  8. <div class=«control-group error»>
  9.  <label class=«control-label» for=«inputError»>Input with error</label>
  10.  <div class=«controls»>
  11.  <input type=«text» id=«inputError»>
  12.  <span class=«help-inline»>Please correct the error</span>
  13.  </div>
  14. </div>
  15. <div class=«control-group success»>
  16.  <label class=«control-label» for=«inputSuccess»>Input with success</label>
  17.  <div class=«controls»>
  18.  <input type=«text» id=«inputSuccess»>
  19.  <span class=«help-inline»>Woohoo!</span>
  20.  </div>
  21. </div>