Note that there are some explanatory texts on larger screens.

plurals
  1. POHTML Forms - In your opinion, how should they be done and why? (<div> vs. <p>)
    primarykey
    data
    text
    <p>I've been a developer for a long time, however forms have always been my least favourite part, more specifically designing them!</p> <p>I'd really like to know how you do you forms, and why. I've had a few discussions with fellow developers over <code>&lt;div&gt;</code> vs <code>&lt;p&gt;</code> on form fields. Which one would you stick with, and why?</p> <p>An example of what I am talking about:</p> <pre><code>&lt;form action="" method="post"&gt; &lt;p&gt; &lt;label for="username"&gt;Username:&lt;/label&gt; &lt;input type="text" name="username" id="username" /&gt; &lt;/p&gt; &lt;p&gt; &lt;label for="submit"&gt;&lt;/label&gt; &lt;input type="submit" name="submit" id="submit" value="Log In" /&gt; &lt;/p&gt; &lt;/form&gt; </code></pre> <p>VS</p> <pre><code>&lt;form action="" method="post"&gt; &lt;div&gt; &lt;label for="username"&gt;Username:&lt;/label&gt; &lt;input type="text" name="username" id="username" /&gt; &lt;/div&gt; &lt;div&gt; &lt;label for="submit"&gt;&lt;/label&gt; &lt;input type="submit" name="submit" id="submit" value="Log In" /&gt; &lt;/div&gt; &lt;/form&gt; </code></pre> <p>When it comes to styling, it seems you can do pretty much the same with both, so is it just personal preference, or is there logic behind using one over the other?</p> <p>Thanks for your time :)</p> <p><strong>UPDATE</strong> I ended up following a nice article on HTML5 forms and have actually found it to allow MUCH better styling of forms. They are much more organised from a development perspective too. For anyone interested, it is located here: <a href="http://24ways.org/2009/have-a-field-day-with-html5-forms">http://24ways.org/2009/have-a-field-day-with-html5-forms</a></p>
    singulars
    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.
 

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