The <label> tag

<label> creates a text caption for a form control, improving both understanding and accessibility (clicking the label focuses/activates the associated control).

Syntax

<label for="email">Email</label>

Attributes

for The id of the form control this label is associated with. Clicking the label text activates that specific control.

Example

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

Notes

  • An alternative to for/id is wrapping the input directly inside the label: <label>Email <input type="email"></label>.

Accessibility

  • Without a label, screen readers can't tell the user what an input field is for.

Related tools