Code examples
Use semantic HTML
This semantic HTML contains all accessibility features by default.
Skip to main content Not main contentAbout main content
The main content of the page belongs here.
When you can’t use semantic HTML
This custom main element requires extra attributes.
Developer notes
Name
- Typically doesn’t have a name other than its role.
Role
- Identifies itself as a main landmark
- If a non-semantic element must be used (like a
<div>
) userole="main"
.
Group
- must contain the main content of the page.
Focus
- Can be targeted with a skip link, but isn’t focusable with the tab key
- Use
tabindex="-1"
to make the main targetable with a skip link.