Skip to main content

The <label> Element

As defined in the HTML Living Standard, the <label> element represents a caption for an item in a user interface.

Visual Example:

<label for="username">Username:</label> <input type="text" id="username"> View HTML Living Standard: The label element

Association Methods

There are two standard ways to associate a label with a form control:

WCAG Requirement: Labels or Instructions

Success Criterion 3.3.2 (Level A): Labels or instructions are provided when content requires user input.

Without a programmatic label, screen reader users may reach a field and hear nothing but "Edit text, blank." By using the <label> element, you ensure the control has an "Accessible Name" (satisfying WCAG SC 4.1.2) that is announced the moment the user focuses on the field.

Understand SC 3.3.2: Labels or Instructions

The "Hit Target" Benefit

The <label> element is not just for screen readers. When a label is associated with a control, clicking the label text will automatically move focus to (or toggle) the control.

A11y Tip: One Label per Control

While a control can have multiple labels, a label should only ever be associated with a single control. If you need to provide additional instructions, use the aria-describedby attribute to link the input to a separate paragraph of text.