diff options
| author | James Friend <[email protected]> | 2014-08-28 09:32:08 +0800 |
|---|---|---|
| committer | James Friend <[email protected]> | 2014-08-28 09:32:08 +0800 |
| commit | 9aeaf19b1dca68ee71e916ae415a0c270a47d301 (patch) | |
| tree | bc8385acb8ec7a46bba03ff2ef7e4283cd9f1146 /docs/_includes/css/forms.html | |
| parent | e7991a9a1e2f474c8f1d8a2e0ed113816f1c5e82 (diff) | |
| parent | 35f09315ed543a0479719afa2143240952c215db (diff) | |
| download | bootstrap-9aeaf19b1dca68ee71e916ae415a0c270a47d301.tar.xz bootstrap-9aeaf19b1dca68ee71e916ae415a0c270a47d301.zip | |
Merge remote-tracking branch 'upstream/master' into node-requirable
Conflicts:
Gruntfile.js
Diffstat (limited to 'docs/_includes/css/forms.html')
| -rw-r--r-- | docs/_includes/css/forms.html | 129 |
1 files changed, 123 insertions, 6 deletions
diff --git a/docs/_includes/css/forms.html b/docs/_includes/css/forms.html index 95bb29c59..5bb99f00c 100644 --- a/docs/_includes/css/forms.html +++ b/docs/_includes/css/forms.html @@ -49,17 +49,17 @@ <button type="submit" class="btn btn-default">Submit</button> </form> {% endhighlight %} - <div class="bs-callout bs-callout-warning"> - <h4>Don't mix form groups with input groups</h4> - <p>Do not mix form groups directly with <a href="/components/#input-groups">input groups</a>. Instead, nest the input group inside of the form group.</p> - </div> + <div class="bs-callout bs-callout-warning"> + <h4>Don't mix form groups with input groups</h4> + <p>Do not mix form groups directly with <a href="/components/#input-groups">input groups</a>. Instead, nest the input group inside of the form group.</p> + </div> <h2 id="forms-inline">Inline form</h2> <p>Add <code>.form-inline</code> to your <code><form></code> for left-aligned and inline-block controls. <strong>This only applies to forms within viewports that are at least 768px wide.</strong></p> <div class="bs-callout bs-callout-danger"> <h4>Requires custom widths</h4> - <p>Inputs, selects, and textareas are 100% wide by default in Bootstrap. To use the inline form, you'll have to set a width on the form controls used within.</p> + <p>Inputs and selects have <code>width: 100%;</code> applied by default in Bootstrap. Within inline forms, we reset that to <code>width: auto;</code> so multiple controls can reside on the same line. Depending on your layout, additional custom widths may be required.</p> </div> <div class="bs-callout bs-callout-warning"> <h4>Always add labels</h4> @@ -96,6 +96,12 @@ <input type="email" class="form-control" id="exampleInputEmail2" placeholder="Enter email"> </div> <div class="form-group"> + <div class="input-group"> + <div class="input-group-addon">@</div> + <input class="form-control" type="email" placeholder="Enter email"> + </div> + </div> + <div class="form-group"> <label class="sr-only" for="exampleInputPassword2">Password</label> <input type="password" class="form-control" id="exampleInputPassword2" placeholder="Password"> </div> @@ -369,7 +375,7 @@ <h2 id="forms-controls-static">Static control</h2> - <p>When you need to place plain text next to a form label within a horizontal form, use the <code>.form-control-static</code> class on a <code><p></code>.</p> + <p>When you need to place plain text next to a form label within a form, use the <code>.form-control-static</code> class on a <code><p></code>.</p> <div class="bs-example"> <form class="form-horizontal" role="form"> <div class="form-group"> @@ -402,6 +408,32 @@ </div> </form> {% endhighlight %} + <div class="bs-example"> + <form class="form-inline" role="form"> + <div class="form-group"> + <label class="sr-only">Email</label> + <p class="form-control-static">[email protected]</p> + </div> + <div class="form-group"> + <label for="inputPassword2" class="sr-only">Password</label> + <input type="password" class="form-control" id="inputPassword2" placeholder="Password"> + </div> + <button type="submit" class="btn btn-default">Confirm identity</button> + </form> + </div> +{% highlight html %} +<form class="form-inline" role="form"> + <div class="form-group"> + <label class="sr-only">Email</label> + <p class="form-control-static">[email protected]</p> + </div> + <div class="form-group"> + <label for="inputPassword2" class="sr-only">Password</label> + <input type="password" class="form-control" id="inputPassword2" placeholder="Password"> + </div> + <button type="submit" class="btn btn-default">Confirm identity</button> +</form> +{% endhighlight %} <h2 id="forms-control-focus">Input focus</h2> <p>We remove the default <code>outline</code> styles on some form controls and apply a <code>box-shadow</code> in its place for <code>:focus</code>.</p> @@ -515,6 +547,30 @@ <label class="control-label" for="inputError1">Input with error</label> <input type="text" class="form-control" id="inputError1"> </div> + <div class="has-success"> + <div class="checkbox"> + <label> + <input type="checkbox" id="checkboxSuccess" value="option1"> + Checkbox with success + </label> + </div> + </div> + <div class="has-warning"> + <div class="checkbox"> + <label> + <input type="checkbox" id="checkboxWarning" value="option1"> + Checkbox with warning + </label> + </div> + </div> + <div class="has-error"> + <div class="checkbox"> + <label> + <input type="checkbox" id="checkboxError" value="option1"> + Checkbox with error + </label> + </div> + </div> </form> </div><!-- /.bs-example --> {% highlight html %} @@ -530,10 +586,35 @@ <label class="control-label" for="inputError1">Input with error</label> <input type="text" class="form-control" id="inputError1"> </div> +<div class="has-success"> + <div class="checkbox"> + <label> + <input type="checkbox" id="checkboxSuccess" value="option1"> + Checkbox with success + </label> + </div> +</div> +<div class="has-warning"> + <div class="checkbox"> + <label> + <input type="checkbox" id="checkboxWarning" value="option1"> + Checkbox with warning + </label> + </div> +</div> +<div class="has-error"> + <div class="checkbox"> + <label> + <input type="checkbox" id="checkboxError" value="option1"> + Checkbox with error + </label> + </div> +</div> {% endhighlight %} <h3>With optional icons</h3> <p>You can also add optional feedback icons with the addition of <code>.has-feedback</code> and the right icon.</p> + <p><strong class="text-danger">Feedback icons only work with textual <code><input class="form-control"></code> elements.</strong></p> <div class="bs-callout bs-callout-warning"> <h4>Icons, labels, and input groups</h4> <p>Manual positioning of feedback icons is required for inputs without a label and for <a href="../components#input-groups">input groups</a> with an add-on on the right. You are strongly encouraged to provide labels for all inputs for accessibility reasons. If you wish to prevent labels from being displayed, hide them with the <code>sr-only</code> class. If you must do without labels, adjust the <code>top</code> value of the feedback icon. For input groups, adjust the <code>right</code> value to an appropriate pixel value depending on the width of your addon.</p> @@ -670,6 +751,42 @@ <select class="form-control input-sm">...</select> {% endhighlight %} + <h3>Horizontal form group sizes</h3> + <p>Quickly size labels and form controls within <code>.form-horizontal</code> by adding <code>.form-group-lg</code> or <code>.form-group-sm</code>.</p> + <div class="bs-example"> + <form class="form-horizontal" role="form"> + <div class="form-group form-group-lg"> + <label class="col-sm-2 control-label" for="formGroupInputLarge">Large label</label> + <div class="col-sm-10"> + <input class="form-control" type="text" id="formGroupInputLarge" placeholder="Large input"> + </div> + </div> + <div class="form-group form-group-sm"> + <label class="col-sm-2 control-label" for="formGroupInputSmall">Small label</label> + <div class="col-sm-10"> + <input class="form-control" type="text" id="formGroupInputSmall" placeholder="Small input"> + </div> + </div> + </form> + </div><!-- /.bs-example --> +{% highlight html %} +<form class="form-horizontal" role="form"> + <div class="form-group form-group-lg"> + <label class="col-sm-2 control-label" for="formGroupInputLarge">Large label</label> + <div class="col-sm-10"> + <input class="form-control" type="text" id="formGroupInputLarge" placeholder="Large input"> + </div> + </div> + <div class="form-group form-group-sm"> + <label class="col-sm-2 control-label" for="formGroupInputSmall">Small label</label> + <div class="col-sm-10"> + <input class="form-control" type="text" id="formGroupInputSmall" placeholder="Small input"> + </div> + </div> +</form> +{% endhighlight %} + + <h3>Column sizing</h3> <p>Wrap inputs in grid columns, or any custom parent element, to easily enforce desired widths.</p> <div class="bs-example"> |
