A semantic, accessible form field

Html

The label is tied to the input by id, and the hint is announced with it via aria-describedby.

<div class="field">
  <label for="email">Email address</label>
  <input id="email" name="email" type="email"
         autocomplete="email" required
         aria-describedby="email-hint" />
  <p id="email-hint">We only use this to send receipts.</p>
</div>

More in Web & CSS

Random picks