Bootstrap3 CSS API Notes - Form
Any element with .form-control
has width:100%;
by default.
You can nest the .input-group
in .form-group
but don’t mix them directly.
Vertical Form in Bootstrap3
|
|
Inline Form in Bootstrap3 (i.e. For a device that has less than 768px width.xs
, the elements that listed inline in larger device will list in block)
|
|
Supported Form Controls
All html5 input type are supported: text
, password
, datetime
, datetime-local
, date
, month
, time
, week
, number
, email
, url
, search
, tel
, color
<fieldset>
can be used to wrap a few form-group in order to easily apply style.
.disabled
can be added to .radio
or .checkbox
or <fieldset>
to disable these elements.
.checkbox-inline
or .radio-inline
create inline-element. They needs to be wrpped in <label>
:
|
|
.form-control-static
can be put in a <p>
tag to create a text that hold the place as a input field
|
|
After using Javascript to valid data in input field, ‘.has-warning’,.has-error
or .has-success
can be added to input fields to show validation result. <span class="glyphicon plyphicon-warning-sign form-control-feedback>
can be added after <input>
field if optional icons are needed.
<span class=".help-block"
can add help text under input field
Input Group
To add icon, put <span class='input-group-addon'></span>
inside a input-group class
To add button attched to input, use .input-group-btn
for a span and add button in span. Put this span right after input box.
Input group can have height class .input-group-lg
.