General notes
- There must only be a one singular header/banner element on the page.
- Contains site title and typically the primary navigation.
Code examples
Use semantic HTML
This semantic HTML contains all accessibility features by default.
When you can’t use semantic HTML
This custom header requires extra attributes.
Developer notes
Name
- Typically doesn’t have a name or description since there must be only one instance per page
Role
- Identifies itself as a header or banner landmark
- If a non-semantic element must be used (like a
<div>
) userole="banner"
to make the element discoverable.
Group
- Contains site title and typically the primary navigation.
Focus
- Can be targeted with a skip link, but the skip link will typically will be labelled “skip to navigation”
- Use
tabindex="-1"
to make the header targetable with a skip link. - The
<header>
itself isn’t focusable with the tab key