Sabtu, 09 Mei 2015

Bootstrap CSS Forms Reference

Bootstrap's Default Settings

Individual form controls automatically receive some global styling with Bootstrap.
All textual <input>, <textarea>, and <select> elements with class="form-control" are set to width: 100%; by default.
Standard rules for Bootstrap forms:

  1. Add role="form" to the <form> element (helps improve accessibility for people using screen readers)
  2. Wrap labels and form controls in a <div> element with class="form-group" (needed for optimum spacing)
  3. Add class="form-control" to all textual <input>, <textarea>, and <select> elements

The following example creates a simple Bootstrap form with two input fields, one checkbox, and a submit button:

Bootstrap Form Example

<form role="form">
  <div class="form-group">
    <label for="email">Email address:</label>
    <input type="email" class="form-control" id="email">
  </div>
  <div class="form-group">
    <label for="pwd">Password:</label>
    <input type="password" class="form-control" id="pwd">
  </div>
  <div class="checkbox">
    <label><input type="checkbox"> Remember me</label>
  </div>
  <button type="submit" class="btn btn-default">Submit</button>
</form>


source reference

0 komentar:

Posting Komentar