]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Always wrap form examples in .bs-example; add some missing role='form'
authorMark Otto <otto@github.com>
Wed, 21 Aug 2013 22:12:55 +0000 (15:12 -0700)
committerMark Otto <otto@github.com>
Wed, 21 Aug 2013 22:12:55 +0000 (15:12 -0700)
css.html

index c686190ecb8959534200c9485fc8ee5f3d5d336f..3ea6a84c731909766896e58a876a738b9ae7113d 100644 (file)
--- a/css.html
+++ b/css.html
@@ -1446,27 +1446,29 @@ For example, <code>&lt;section&gt;</code> should be wrapped as inline.
 
     <h2 id="forms-example">Basic example</h2>
     <p>Individual form controls automatically receive some global styling. All textual <code>&lt;input&gt;</code>, <code>&lt;textarea&gt;</code>, and <code>&lt;select&gt;</code> elements with <code>.form-control</code> are set to <code>width: 100%;</code> by default. Wrap labels and controls in <code>.form-group</code> for optimum spacing.</p>
-    <form class="bs-example" role="form">
-      <div class="form-group">
-        <label for="exampleInputEmail1">Email address</label>
-        <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email">
-      </div>
-      <div class="form-group">
-        <label for="exampleInputPassword1">Password</label>
-        <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
-      </div>
-      <div class="form-group">
-        <label for="exampleInputFile">File input</label>
-        <input type="file" id="exampleInputFile">
-        <p class="help-block">Example block-level help text here.</p>
-      </div>
-      <div class="checkbox">
-        <label>
-          <input type="checkbox"> Check me out
-        </label>
-      </div>
-      <button type="submit" class="btn btn-default">Submit</button>
-    </form><!-- /example -->
+    <div class="bs-example">
+      <form role="form">
+        <div class="form-group">
+          <label for="exampleInputEmail1">Email address</label>
+          <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email">
+        </div>
+        <div class="form-group">
+          <label for="exampleInputPassword1">Password</label>
+          <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
+        </div>
+        <div class="form-group">
+          <label for="exampleInputFile">File input</label>
+          <input type="file" id="exampleInputFile">
+          <p class="help-block">Example block-level help text here.</p>
+        </div>
+        <div class="checkbox">
+          <label>
+            <input type="checkbox"> Check me out
+          </label>
+        </div>
+        <button type="submit" class="btn btn-default">Submit</button>
+      </form>
+    </div><!-- /example -->
 {% highlight html %}
 <form role="form">
   <div class="form-group">
@@ -1502,22 +1504,24 @@ For example, <code>&lt;section&gt;</code> should be wrapped as inline.
       <h4>Always add labels</h4>
       <p>Screen readers will have trouble with your forms if you don't include a label for every input. For these inline forms, you can hide the labels using the <code>.sr-only</code> class.</p>
     </div>
-    <form class="bs-example form-inline" role="form">
-      <div class="form-group">
-        <label class="sr-only" for="exampleInputEmail2">Email address</label>
-        <input type="email" class="form-control" id="exampleInputEmail2" placeholder="Enter email">
-      </div>
-      <div class="form-group">
-        <label class="sr-only" for="exampleInputPassword2">Password</label>
-        <input type="password" class="form-control" id="exampleInputPassword2" placeholder="Password">
-      </div>
-      <div class="checkbox">
-        <label>
-          <input type="checkbox"> Remember me
-        </label>
-      </div>
-      <button type="submit" class="btn btn-default">Sign in</button>
-    </form><!-- /example -->
+    <div class="bs-example">
+      <form class="form-inline" role="form">
+        <div class="form-group">
+          <label class="sr-only" for="exampleInputEmail2">Email address</label>
+          <input type="email" class="form-control" id="exampleInputEmail2" placeholder="Enter email">
+        </div>
+        <div class="form-group">
+          <label class="sr-only" for="exampleInputPassword2">Password</label>
+          <input type="password" class="form-control" id="exampleInputPassword2" placeholder="Password">
+        </div>
+        <div class="checkbox">
+          <label>
+            <input type="checkbox"> Remember me
+          </label>
+        </div>
+        <button type="submit" class="btn btn-default">Sign in</button>
+      </form>
+    </div><!-- /example -->
 {% highlight html %}
 <form class="form-inline" role="form">
   <div class="form-group">
@@ -1540,34 +1544,36 @@ For example, <code>&lt;section&gt;</code> should be wrapped as inline.
 
     <h2 id="forms-horizontal">Horizontal form</h2>
     <p>Use Bootstrap's predefined grid classes to align labels and groups of form controls in a horizontal layout by adding <code>.form-horizontal</code> to the form. Doing so changes <code>.form-group</code>s to behave as grid rows, so no need for <code>.row</code>.</p>
-    <form class="bs-example form-horizontal">
-      <div class="form-group">
-        <label for="inputEmail1" class="col-lg-2 control-label">Email</label>
-        <div class="col-lg-10">
-          <input type="email" class="form-control" id="inputEmail1" placeholder="Email">
+    <div class="bs-example">
+      <form class="form-horizontal">
+        <div class="form-group">
+          <label for="inputEmail1" class="col-lg-2 control-label">Email</label>
+          <div class="col-lg-10">
+            <input type="email" class="form-control" id="inputEmail1" placeholder="Email">
+          </div>
         </div>
-      </div>
-      <div class="form-group">
-        <label for="inputPassword1" class="col-lg-2 control-label">Password</label>
-        <div class="col-lg-10">
-          <input type="password" class="form-control" id="inputPassword1" placeholder="Password">
+        <div class="form-group">
+          <label for="inputPassword1" class="col-lg-2 control-label">Password</label>
+          <div class="col-lg-10">
+            <input type="password" class="form-control" id="inputPassword1" placeholder="Password">
+          </div>
         </div>
-      </div>
-      <div class="form-group">
-        <div class="col-lg-offset-2 col-lg-10">
-          <div class="checkbox">
-            <label>
-              <input type="checkbox"> Remember me
-            </label>
+        <div class="form-group">
+          <div class="col-lg-offset-2 col-lg-10">
+            <div class="checkbox">
+              <label>
+                <input type="checkbox"> Remember me
+              </label>
+            </div>
           </div>
         </div>
-      </div>
-      <div class="form-group">
-        <div class="col-lg-offset-2 col-lg-10">
-          <button type="submit" class="btn btn-default">Sign in</button>
+        <div class="form-group">
+          <div class="col-lg-offset-2 col-lg-10">
+            <button type="submit" class="btn btn-default">Sign in</button>
+          </div>
         </div>
-      </div>
-    </form>
+      </form>
+    </div><!-- /.bs-example -->
 {% highlight html %}
 <form class="form-horizontal" role="form">
   <div class="form-group">
@@ -1609,18 +1615,22 @@ For example, <code>&lt;section&gt;</code> should be wrapped as inline.
       <h4>Type declaration required</h4>
       <p>Inputs will only be fully styled if their <code>type</code> is properly declared.</p>
     </div>
-    <form class="bs-example">
-      <input type="text" class="form-control" placeholder="Text input">
-    </form>
+    <div class="bs-example">
+      <form role="form">
+        <input type="text" class="form-control" placeholder="Text input">
+      </form>
+    </div><!-- /.bs-example -->
 {% highlight html %}
 <input type="text" class="form-control" placeholder="Text input">
 {% endhighlight %}
 
     <h3>Textarea</h3>
     <p>Form control which supports multiple lines of text. Change <code>rows</code> attribute as necessary.</p>
-    <form class="bs-example">
-      <textarea class="form-control" rows="3"></textarea>
-    </form>
+    <div class="bs-example">
+      <form role="form">
+        <textarea class="form-control" rows="3"></textarea>
+      </form>
+    </div><!-- /.bs-example -->
 {% highlight html %}
 <textarea class="form-control" rows="3"></textarea>
 {% endhighlight %}
@@ -1628,27 +1638,29 @@ For example, <code>&lt;section&gt;</code> should be wrapped as inline.
     <h3>Checkboxes and radios</h3>
     <p>Checkboxes are for selecting one or several options in a list while radios are for selecting one option from many.</p>
     <h4>Default (stacked)</h4>
-    <form class="bs-example">
-      <div class="checkbox">
-        <label>
-          <input type="checkbox" value="">
-          Option one is this and that&mdash;be sure to include why it's great
-        </label>
-      </div>
-      <br>
-      <div class="radio">
-        <label>
-          <input type="radio" name="optionsRadios" id="optionsRadios1" value="option1" checked>
-          Option one is this and that&mdash;be sure to include why it's great
-        </label>
-      </div>
-      <div class="radio">
-        <label>
-          <input type="radio" name="optionsRadios" id="optionsRadios2" value="option2">
-          Option two can be something else and selecting it will deselect option one
-        </label>
-      </div>
-    </form>
+    <div class="bs-example">
+      <form role="form">
+        <div class="checkbox">
+          <label>
+            <input type="checkbox" value="">
+            Option one is this and that&mdash;be sure to include why it's great
+          </label>
+        </div>
+        <br>
+        <div class="radio">
+          <label>
+            <input type="radio" name="optionsRadios" id="optionsRadios1" value="option1" checked>
+            Option one is this and that&mdash;be sure to include why it's great
+          </label>
+        </div>
+        <div class="radio">
+          <label>
+            <input type="radio" name="optionsRadios" id="optionsRadios2" value="option2">
+            Option two can be something else and selecting it will deselect option one
+          </label>
+        </div>
+      </form>
+    </div><!-- /.bs-example -->
 {% highlight html %}
 <div class="checkbox">
   <label>
@@ -1673,17 +1685,19 @@ For example, <code>&lt;section&gt;</code> should be wrapped as inline.
 
     <h4>Inline checkboxes</h4>
     <p>Use <code>.checkbox-inline</code> or <code>.radio-inline</code> class to a series of checkboxes or radios for controls appear on the same line.</p>
-    <form class="bs-example">
-      <label class="checkbox-inline">
-        <input type="checkbox" id="inlineCheckbox1" value="option1"> 1
-      </label>
-      <label class="checkbox-inline">
-        <input type="checkbox" id="inlineCheckbox2" value="option2"> 2
-      </label>
-      <label class="checkbox-inline">
-        <input type="checkbox" id="inlineCheckbox3" value="option3"> 3
-      </label>
-    </form>
+    <div class="bs-example">
+      <form role="form">
+        <label class="checkbox-inline">
+          <input type="checkbox" id="inlineCheckbox1" value="option1"> 1
+        </label>
+        <label class="checkbox-inline">
+          <input type="checkbox" id="inlineCheckbox2" value="option2"> 2
+        </label>
+        <label class="checkbox-inline">
+          <input type="checkbox" id="inlineCheckbox3" value="option3"> 3
+        </label>
+      </form>
+    </div><!-- /.bs-example -->
 {% highlight html %}
 <label class="checkbox-inline">
   <input type="checkbox" id="inlineCheckbox1" value="option1"> 1
@@ -1698,23 +1712,25 @@ For example, <code>&lt;section&gt;</code> should be wrapped as inline.
 
     <h3>Selects</h3>
     <p>Use the default option, or add <code>multiple</code> to show multiple options at once.</p>
-    <form class="bs-example">
-      <select class="form-control">
-        <option>1</option>
-        <option>2</option>
-        <option>3</option>
-        <option>4</option>
-        <option>5</option>
-      </select>
-      <br>
-      <select multiple class="form-control">
-        <option>1</option>
-        <option>2</option>
-        <option>3</option>
-        <option>4</option>
-        <option>5</option>
-      </select>
-    </form>
+    <div class="bs-example">
+      <form role="form">
+        <select class="form-control">
+          <option>1</option>
+          <option>2</option>
+          <option>3</option>
+          <option>4</option>
+          <option>5</option>
+        </select>
+        <br>
+        <select multiple class="form-control">
+          <option>1</option>
+          <option>2</option>
+          <option>3</option>
+          <option>4</option>
+          <option>5</option>
+        </select>
+      </form>
+    </div><!-- /.bs-example -->
 {% highlight html %}
 <select class="form-control">
   <option>1</option>
@@ -1736,20 +1752,22 @@ For example, <code>&lt;section&gt;</code> should be wrapped as inline.
 
     <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>&lt;p&gt;</code>.</p>
-    <form class="bs-example form-horizontal">
-      <div class="form-group">
-        <label class="col-lg-2 control-label">Email</label>
-        <div class="col-lg-10">
-          <p class="form-control-static">email@example.com</p>
+    <div class="bs-example">
+      <form class="form-horizontal" role="form">
+        <div class="form-group">
+          <label class="col-lg-2 control-label">Email</label>
+          <div class="col-lg-10">
+            <p class="form-control-static">email@example.com</p>
+          </div>
         </div>
-      </div>
-      <div class="form-group">
-        <label for="inputPassword" class="col-lg-2 control-label">Password</label>
-        <div class="col-lg-10">
-          <input type="password" class="form-control" id="inputPassword" placeholder="Password">
+        <div class="form-group">
+          <label for="inputPassword" class="col-lg-2 control-label">Password</label>
+          <div class="col-lg-10">
+            <input type="password" class="form-control" id="inputPassword" placeholder="Password">
+          </div>
         </div>
-      </div>
-    </form>
+      </form>
+    </div><!-- /.bs-example -->
 {% highlight html %}
 <form class="form-horizontal" role="form">
   <div class="form-group">
@@ -1773,18 +1791,22 @@ For example, <code>&lt;section&gt;</code> should be wrapped as inline.
 
     <h3 id="forms-input-focus">Input focus</h3>
     <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>
-    <form class="bs-example">
-      <input class="form-control" id="focusedInput" type="text" value="This is focused...">
-    </form>
+    <div class="bs-example">
+      <form role="form">
+        <input class="form-control" id="focusedInput" type="text" value="This is focused...">
+      </div>
+    </div>
 {% highlight html %}
 <input class="form-control" id="focusedInput" type="text" value="This is focused...">
 {% endhighlight %}
 
     <h3 id="forms-disabled-inputs">Disabled inputs</h3>
     <p>Add the <code>disabled</code> attribute on an input to prevent user input and trigger a slightly different look.</p>
-    <form class="bs-example">
-      <input class="form-control" id="disabledInput" type="text" placeholder="Disabled input here…" disabled>
-    </form>
+    <div class="bs-example">
+      <form role="form">
+        <input class="form-control" id="disabledInput" type="text" placeholder="Disabled input here…" disabled>
+      </form>
+    </div><!-- /.bs-example -->
 {% highlight html %}
 <input class="form-control" id="disabledInput" type="text" placeholder="Disabled input here..." disabled>
 {% endhighlight %}
@@ -1802,26 +1824,28 @@ For example, <code>&lt;section&gt;</code> should be wrapped as inline.
       <p>While Bootstrap will apply these styles in all browsers, Internet Explorer 9 and below don't actually support the <code>disabled</code> attribute on a <code>&lt;fieldset&gt;</code>. Use custom JavaScript to disable the fieldset in these browsers.</p>
     </div>
 
-    <form class="bs-example">
-      <fieldset disabled>
-        <div class="form-group">
-          <label for="disabledTextInput">Disabled input</label>
-          <input type="text" id="disabledTextInput" class="form-control" placeholder="Disabled input">
-        </div>
-        <div class="form-group">
-          <label for="disabledSelect">Disabled select menu</label>
-          <select id="disabledSelect" class="form-control">
-            <option>Disabled select</option>
-          </select>
-        </div>
-        <div class="checkbox">
-          <label>
-            <input type="checkbox"> Can't check this
-          </label>
-        </div>
-        <button type="submit" class="btn btn-primary">Submit</button>
-      </fieldset>
-    </form>
+    <div class="bs-example">
+      <form role="form">
+        <fieldset disabled>
+          <div class="form-group">
+            <label for="disabledTextInput">Disabled input</label>
+            <input type="text" id="disabledTextInput" class="form-control" placeholder="Disabled input">
+          </div>
+          <div class="form-group">
+            <label for="disabledSelect">Disabled select menu</label>
+            <select id="disabledSelect" class="form-control">
+              <option>Disabled select</option>
+            </select>
+          </div>
+          <div class="checkbox">
+            <label>
+              <input type="checkbox"> Can't check this
+            </label>
+          </div>
+          <button type="submit" class="btn btn-primary">Submit</button>
+        </fieldset>
+      </form>
+    </div><!-- /.bs-example -->
 {% highlight html %}
 <form class="form-inline" role="form">
   <fieldset disabled>
@@ -1848,20 +1872,22 @@ For example, <code>&lt;section&gt;</code> should be wrapped as inline.
     <h3 id="forms-validation">Validation states</h3>
     <p>Bootstrap includes validation styles for error, warning, and success states on form controls. To use, add <code>.has-warning</code>, <code>.has-error</code>, or <code>.has-success</code> to the parent element. Any <code>.control-label</code>, <code>.form-control</code>, and <code>.help-block</code> within that element will receive the validation styles.</p>
 
-    <form class="bs-example">
-      <div class="form-group has-success">
-        <label class="control-label" for="inputSuccess">Input with success</label>
-        <input type="text" class="form-control" id="inputSuccess">
-      </div>
-      <div class="form-group has-warning">
-        <label class="control-label" for="inputWarning">Input with warning</label>
-        <input type="text" class="form-control" id="inputWarning">
-      </div>
-      <div class="form-group has-error">
-        <label class="control-label" for="inputError">Input with error</label>
-        <input type="text" class="form-control" id="inputError">
-      </div>
-    </form>
+    <div class="bs-example">
+      <form role="form">
+        <div class="form-group has-success">
+          <label class="control-label" for="inputSuccess">Input with success</label>
+          <input type="text" class="form-control" id="inputSuccess">
+        </div>
+        <div class="form-group has-warning">
+          <label class="control-label" for="inputWarning">Input with warning</label>
+          <input type="text" class="form-control" id="inputWarning">
+        </div>
+        <div class="form-group has-error">
+          <label class="control-label" for="inputError">Input with error</label>
+          <input type="text" class="form-control" id="inputError">
+        </div>
+      </form>
+    </div><!-- /.bs-example -->
 {% highlight html %}
 <div class="form-group has-success">
   <label class="control-label" for="inputSuccess">Input with success</label>
@@ -1883,23 +1909,25 @@ For example, <code>&lt;section&gt;</code> should be wrapped as inline.
 
     <h3>Height sizing</h3>
     <p>Create larger or smaller form controls that match button sizes.</p>
-    <form class="bs-example bs-example-control-sizing">
-      <div class="controls docs-input-sizes">
-        <input class="form-control input-lg" type="text" placeholder=".input-lg">
-        <input type="text" class="form-control" placeholder="Default input">
-        <input class="form-control input-sm" type="text" placeholder=".input-sm">
-
-        <select class="form-control input-lg">
-          <option value="">.input-lg</option>
-        </select>
-        <select class="form-control">
-          <option value="">Default select</option>
-        </select>
-        <select class="form-control input-sm">
-          <option value="">.input-sm</option>
-        </select>
-      </div>
-    </form>
+    <div class="bs-example bs-example-control-sizing">
+      <form role="form">
+        <div class="controls">
+          <input class="form-control input-lg" type="text" placeholder=".input-lg">
+          <input type="text" class="form-control" placeholder="Default input">
+          <input class="form-control input-sm" type="text" placeholder=".input-sm">
+
+          <select class="form-control input-lg">
+            <option value="">.input-lg</option>
+          </select>
+          <select class="form-control">
+            <option value="">Default select</option>
+          </select>
+          <select class="form-control input-sm">
+            <option value="">.input-sm</option>
+          </select>
+        </div>
+      </form>
+    </div><!-- /.bs-example -->
 {% highlight html %}
 <input class="form-control input-lg" type="text" placeholder=".input-lg">
 <input class="form-control" type="text" placeholder="Default input">
@@ -1912,19 +1940,21 @@ For example, <code>&lt;section&gt;</code> should be wrapped as inline.
 
     <h3>Column sizing</h3>
     <p>Wrap inputs in grid columns, or any custom parent element, to easily enforce desired widths.</p>
-    <form class="bs-example" style="padding-bottom: 15px;">
-      <div class="row">
-        <div class="col-lg-2">
-          <input type="text" class="form-control" placeholder=".col-lg-2">
-        </div>
-        <div class="col-lg-3">
-          <input type="text" class="form-control" placeholder=".col-lg-3">
-        </div>
-        <div class="col-lg-4">
-          <input type="text" class="form-control" placeholder=".col-lg-4">
+    <div class="bs-example">
+      <form role="form">
+        <div class="row">
+          <div class="col-lg-2">
+            <input type="text" class="form-control" placeholder=".col-lg-2">
+          </div>
+          <div class="col-lg-3">
+            <input type="text" class="form-control" placeholder=".col-lg-3">
+          </div>
+          <div class="col-lg-4">
+            <input type="text" class="form-control" placeholder=".col-lg-4">
+          </div>
         </div>
-      </div>
-    </form>
+      </form>
+    </div><!-- /.bs-example -->
 {% highlight html %}
 <div class="row">
   <div class="col-lg-2">
@@ -1941,10 +1971,12 @@ For example, <code>&lt;section&gt;</code> should be wrapped as inline.
 
     <h2 id="forms-help-text">Help text</h2>
     <p>Block level help text for form controls.</p>
-    <form class="bs-example">
-      <input type="text" class="form-control">
-      <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>
-    </form>
+    <div class="bs-example">
+      <form role="form">
+        <input type="text" class="form-control">
+        <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>
+      </form>
+    </div><!-- /.bs-example -->
 {% highlight html %}
 <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>
 {% endhighlight %}