Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is probably related to the question: <a href="https://stackoverflow.com/questions/7182966/div-usage-correctly-cant-get-the-columns-to-line-up/7186736#7186736"><code>&lt;div&gt;</code> usage correctly? Can't get the columns to line up</a>: You can also check my comments there for some reference when dealing with semantically-correct forms. </p> <p>The approach you will need to be in habit of is <em>always</em> structure your markup <em>correctly</em> first before jumping to any CSS <em>(or styling)</em>. </p> <p>A <code>&lt;form&gt;</code> is composed of the following: </p> <ol> <li>The <code>&lt;form&gt;</code> itself. </li> <li>The <code>&lt;fieldset&gt;</code>: acts a the container of the different sections of your <code>&lt;form&gt;</code></li> <li>The <code>&lt;legend&gt;</code>: acts as the heading of the <code>&lt;fieldset&gt;</code></li> <li>The <code>&lt;input /&gt;</code>: for fields, checkboxes, radio buttons, and submit button</li> <li>The <code>&lt;button&gt;</code>: an alternative for <code>&lt;input type="submit"&gt;</code>, which can wrap something inside of it. </li> <li>The <code>&lt;select&gt;</code>: a list of values inside a drop-down menu. </li> <li>The <code>&lt;label&gt;</code>: from the name itself, the <strong>label</strong> of the <code>&lt;input /&gt;</code>, <code>&lt;button&gt;</code> and <code>&lt;select&gt;</code> </li> </ol> <p>To illustrate, you can check this example: </p> <pre><code>&lt;form&gt; &lt;fieldset&gt; &lt;legend&gt;Form Heading: &lt;/legend&gt; &lt;fieldset&gt; &lt;legend&gt;Group 1 Heading: &lt;/legend&gt; &lt;label for="input-id"&gt;Input Label: &lt;/label&gt; &lt;input id="input-id" /&gt; &lt;/fieldset&gt; &lt;fieldset&gt; &lt;legend&gt;Group 2 Heading: &lt;/legend&gt; &lt;label for="select-id"&gt;Select Label: &lt;/label&gt; &lt;select id="select-id"&gt; &lt;option&gt;Option 1&lt;/option&gt; &lt;option&gt;Option 2&lt;/option&gt; &lt;option&gt;Option 3&lt;/option&gt; &lt;/select&gt; &lt;/fieldset&gt; &lt;input type="submit" value="Submit" /&gt; &lt;/fieldset&gt; &lt;/form&gt; </code></pre> <p>With the exception of radio <em>(<code>&lt;input type="radio" /&gt;</code>)</em> and checkboxes <em>(<code>&lt;input type="checkbox" /&gt;</code>)</em>, where the <code>&lt;label&gt;</code> should come <strong>after</strong> the <code>&lt;input /&gt;</code></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload