Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I am going to give you the answer - but first I want to explain some semantics and how one can properly code a form WITHOUT using tables.</p> <p>Html form have been around since the inception of html. You will be amazed how many html form elements ARE NOT utilized when they simply exist to help you code properly semantic html. Proper semantic html means:</p> <p>1) Your code is accessible to text viewers such as Google search engine and browsers used by blind people 2) Fulfills federal law (US laws require school/government websites to be accessible) 3) Will make it easier for you to code the backend (php) in the long run.</p> <p>A form at its barebones should include:</p> <pre><code>&lt;form&gt; &lt;fieldset&gt; &lt;div&gt; &lt;label for="first-name"&gt;First Name&lt;/label&gt; &lt;input type="textbox" name="first_name" id="first-name" value="" /&gt; &lt;/div&gt; &lt;div&gt; &lt;label for="gender_selection"&gt;Gender&lt;/label&gt; &lt;select name="gender" id="gender_selection"&gt; &lt;option value="male"&gt;Male&lt;/option&gt; &lt;option value="female"&gt;Female&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; &lt;/fieldset&gt; &lt;/form&gt; </code></pre> <ul> <li>You must have a <code>fieldset</code> tag for each <code>form</code> tag.</li> <li><code>label</code> tag is used to define what the form element stands for. THIS IS WHAT tells a text viewer what each form element stands for! Sure you can do without but why when this tag was created for exactly that purpose.</li> <li>The div tags will allow you to easily style errors/corrections needed.</li> </ul> <p>CSS</p> <pre><code>form div { overflow: hidden; } form div label { float: left; width: 120px; padding: 0 20px 0 0; } form div input, form div select { float: left; width: 220px; } </code></pre> <p>Simple css (not tested) to mimic your tabular forms with the added advantage of not using tables, being accessible, and using proper html.</p> <p>Now if a user made an error with in let us say <code>first name</code> we simply add class <code>.error</code> to that div:</p> <pre><code> &lt;div class="error"&gt; &lt;label for="first-name"&gt;First Name&lt;/label&gt; &lt;input type="textbox" name="first_name" id="first-name" value="" /&gt; &lt;/div&gt; </code></pre> <p>CSS:</p> <pre><code>div.error label { color: red; } div.error input { border: red; color: red; } </code></pre> <p>ANSWER TO YOUR QUESTION:</p> <p>Your html form "label" elements do not have a fixed width. Add a fixed width by either adding an extra <code>&lt;td&gt;</code> column or using the code I provided above.</p> <p>Hopefully this post will help you for the future.</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.
    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