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:

<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>
</label>

Note

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>
</label>