--- layout: default title: "Forms" date: 2013-05-17 23:24:04 --- Forms ====== Elements -------- ### Input 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.
~~~html ~~~ ### Textarea Change rows attribute as necessary.
~~~html ~~~ ### Checkbox Checkboxes will stack on top of each other.
~~~html ~~~ Add the class `.inline` to enable inline flow.
~~~html ~~~ ### Radio Radio boxes works in the exact same way as checkboxes. ### Select Specify a multiple="multiple" to show multiple options at once.
~~~html ~~~ Default Style ------------- Without any added classes, forms will be styled in a classic, unobtrusive style.
Legend Example block-level help text here.
~~~html
Legend Example block-level help text here.
~~~ Inline Style --------------- Add `.form-inline` for left-aligned labels and inline-block controls for a compact layout.
~~~html
~~~ Horizontal Style ---------------- 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
~~~html
~~~ Grid Sizing ----------- You can use `.span1` to `.span12` for inputs that match the same sizes of the grid columns.
~~~html ~~~ 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 clears the float.
~~~html
~~~ Relative Sizing --------------- You can relatively size input fields by using the `.input-[size]` classes.
~~~html ~~~ Prepend & Append ---------------- Wrap an .add-on and an input with one of two classes to prepend or append text to an input. You can use both at the same time to show on both sides.
@
.00
$ .00
~~~html
@
.00
$ .00
~~~ You can also use buttons as prepend/append elements.
~~~html
~~~ Even two buttons
~~~html
~~~ Help Text --------- You can create inline helper text.
Inline text
~~~html Inline text ~~~ And you can create block helper text.
Long text with a link ...
~~~html Long text with a link ... ~~~ Disable ------- Disable an input field by using the `disabled` attribute, or create something that looks like a form element, but isn't by using the `.uneditable-input` class.
Disabled fake input
~~~html Disabled fake input ~~~