Why use definition lists (DL,DD,DT) tags for HTML forms instead of tables?

I guess it’s up to you to determine the semantics, but in my opinion:

Rather than a definition list, form-related properties should be used.

<form>
  <label for="fullname">Full Name:</label>
  <input type="text" name="fullname" id="fullname">
  <label for="email">Email Address:</label>
  <input type="text" name="email" id="email">
</form>

The “for” attribute in the <label> tag should reference the “id” attribute of a <input> tag. Note that when labels are associated with fields, clicking the label will put the associated field in focus.

You can also use tags like <fieldset> to cluster sections of a form together and <legend> to caption a fieldset.

Leave a Comment