STAGE 01 / LESSON 04
HTML and semantic structure
HTML describes the meaning and structure of content, not just how it looks.
THE IDEA
Understand it.
Elements such as main, nav, heading, form and button communicate purpose to browsers, assistive technology and other tools. A heading hierarchy and meaningful link text help people understand a page.
A label connected to an input gives that control an accessible name. Native buttons and form controls already support keyboard interaction, so use them before inventing custom controls.
SEE IT IN CONTEXT
A small accessible form
<main>
<h1>Create a task</h1>
<form>
<label for="title">Task title</label>
<input id="title" name="title" required>
<button type="submit">Create task</button>
</form>
</main>The label points to the input’s id. The form and button have built-in browser behavior; server-side validation is still needed.
LEARN FROM REAL WEBSITES
See it in the real world.
These simplified structures come from public sources. Company systems change, and the sources may describe only one project or an earlier design.
GOV.UK
Documentation checked November 2026Connect a label to an input
The GOV.UK design system publishes a text input pattern with a visible HTML label associated with its input.
- Label
- Associated input
- Person enters a value
What to learn: Meaningful HTML gives a field an accessible name. This is a published service pattern, not a claim about every GOV.UK page.
Read the source: GOV.UK text input patternGitHub
GitHub engineering, 2025Document accessible components
GitHub explains how its design annotations capture accessibility information for interface components.
- Component design
- Accessibility annotations
- Implementation and review
What to learn: Semantic roles and accessible names need to be carried from design into HTML; a visual appearance alone does not describe a control.
Read the source: GitHub accessibility annotationsTRY IT YOURSELF
Practice.
Add a labeled due-date input to the form. Which attribute connects its label to the input?
Show one possible answer
Give the input a unique id, such as due-date, and set the label’s for attribute to the same value.
GO DEEPER