HTML: label

The <label> element gives a form control a visible name and connects the instruction to the control.

What you will learn

Explicit association

<label for="email">Email address</label>
<input id="email" name="email" type="email">

The label’s for value must exactly match the input’s id. Clicking the label then focuses the input, and assistive technology can announce its purpose.

Wrapping the control

<label>
  Subscribe to updates
  <input name="subscribe" type="checkbox">
</label>

You can also place the control inside the label. Choose one clear pattern and avoid assigning two different labels that give conflicting instructions.

Common mistakes