Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS [Solved] structure of a form Reply To: structure of a form

#150250
Paulie_D
Member

You can structure the internals of a form pretty much any way you want. Some people use tables, some divs…some even use definitions lists

Over on HTMl5Doctor they have a form ‘snippet’ like this:

<form id="app-login" action="process.php">
<fieldset>
<legend>Login Details</legend>
<div>
  <label for="user-name">Username:</label>

  <input name="user-name" type="email" placeholder="Your username is your email address" required autofocus>
</div>
<div>

  <label for="password">Password:</label>
  <input name="password" type="password" placeholder="6 digits, a combination of numbers and letters" required>
</div>
<div>
  <input name="login" type="submit" value="Login">
</div>
</fieldset>
</form>

Divs have no semantic meaning in and of themselves…so can use them however you wish.

So divs are fine…and it would be my preferred option.