7.1.2. Include information about expected field values directly in <label> tags

Information about the nature of expected values should be directly included in the <label> tags.

This is especially the case for:

  • Statements of type “Mandatory field”.
  • Indications that provide the format of values required; for example, “DD/MM/YYYY” for a date format.
  • Indications that show the maximum size of files that can be sent.
  • Etc.
<p>Fields marked with an asterisk (*) are mandatory.</p>
<label for="name">Your name *</label>
<input type="text" id="name" name="name" />
<label for="client-number">
    Your client number
    <input type="text" id="client-number" name="client-number" />
    <em>For example: 76432-BT-VZ</em>


Sometimes, error messages are displayed at the level of each field. In this case, they must also be included in the associated <label> tags.

<p>Fields marked with an asterisk (*) are mandatory.</p>
<label for="email">
    Your email address *
    <input type="text" id="email" name="email" />
    <span class="error">Please enter your email address (expected format: example@domain.us).</span>

notices/html-css/integrer-les-informations-utiles-a-la-saisie-directement-dans-les-balises-label.txt · Last modified: 30 December 2013 at 18:07 by Sébastien Delorme (Atalan)

Project coordinated by Atalan.

In partnership with: