HTML Accessible Names and Descriptions
Name with visible text
An accessible name identifies a control. Prefer visible text or a native label. A label for attribute points to the unique id of a labelable control, giving both a visual label and a programmatic association.
<label for="email">Email address</label><input id="email" type="email">The textbox name is Email address.
Name from another element
For an element that allows author naming, aria-labelledby references one or more IDs. It normally takes precedence over aria-label when valid references are present. Use aria-label for a suitable control without visible label text, such as an icon-only button.
<h2 id="heading">Downloads</h2><section aria-labelledby="heading"> <button type="button" aria-label="Close">×</button></section>The region is named Downloads and the button Close.
Add a description
A description supplies supplementary context, not the control’s identity. aria-describedby references text by ID; keep the essential label short and put format guidance in a separate visible paragraph.
<label for="code">Course code</label><input id="code" aria-describedby="hint"><p id="hint">Use three letters.</p>The name is Course code and the description is Use three letters.
Common mistakes and practice
Do not rely on placeholder as a label; it disappears during editing. Keep the accessible name consistent with visible wording. Check referenced IDs and inspect name and description separately.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
HTML Accessible Names and Descriptions — Knowledge Check
Apply the accessibility concepts taught in this lesson.
What does a control name identify?
Which native attribute connects a label to an input id?
Which attribute references supplemental guidance?
What usually takes precedence over aria-label when valid references exist?
What is best for an ordinary text field?