What are landmark elements?
Landmark elements are semantic HTML elements that define the structure and major regions of your web page. They help screen reader users navigate your content efficiently by allowing them to jump directly to different sections.Common landmark elements
header
Contains introductory content, typically including navigation and branding. Maps to the
banner landmark role.nav
Contains navigation links. Screen readers can jump directly to navigation menus.
main
Contains the primary content of the page. There should only be one
<main> per page.footer
Contains footer information like copyright, links, and contact info. Maps to the
contentinfo landmark role.section
Represents a standalone section of content. Should typically have a heading and/or
aria-labelledby.aside
Contains content tangentially related to the main content, like sidebars or callouts.
article
Represents a self-contained piece of content that could stand alone (blog posts, news articles, etc.).
form
Contains form controls. Use
role="search" for search forms.Why landmarks matter
Screen reader users rely on landmarks to understand page structure and navigate efficiently. Without proper landmarks: With proper landmarks:- Users can jump directly to navigation, main content, or footer
- Screen readers announce regions clearly (“navigation”, “main”, etc.)
- Users can get a quick overview of page structure
- Navigation is faster and more efficient
Proper landmark usage
Here’s an example of proper landmark structure from the course website:introduction.html
Key features of this structure:
Skip link in header
The
<a href="#main-content"> link allows keyboard users to skip directly to main content, bypassing repeated navigation.Navigation inside header
The
<nav> element is nested within <header>, clearly marking the navigation region.Main content with ID and tabindex
The
<main> element has id="main-content" (for the skip link target) and tabindex="-1" (to allow programmatic focus).tabindex="-1" allows JavaScript to focus the element (for skip links) without adding it to the natural tab order.Using sections with labels
When using<section> elements, always provide a label using aria-labelledby to reference a heading ID:
Why use aria-labelledby?
Provides context
Provides context
Screen readers announce the section with its label: “Screen readers, region” - giving users immediate context about the content.
Improves navigation
Improves navigation
Follows best practices
Follows best practices
WCAG guidelines recommend labeling all landmark regions when there are multiple landmarks of the same type.
Nested sections
You can nest sections for hierarchical content structure:Best practices
Use one main per page
Use one main per page
Every page should have exactly one
<main> element containing the primary content.Don't skip heading levels
Don't skip heading levels
Maintain a logical heading hierarchy (h1 → h2 → h3). Don’t skip from h1 to h3.
Label multiple landmarks of the same type
Label multiple landmarks of the same type
If you have multiple
<nav> or <section> elements, label them to distinguish between them.Use semantic HTML over ARIA
Use semantic HTML over ARIA
Prefer native HTML landmarks over ARIA roles when possible.
Avoid div soup
Avoid div soup
Don’t create unnecessary div nesting. Use semantic elements to provide structure.
Common mistakes
The Broken Landmarks page intentionally demonstrates several landmark-related issues:Testing landmarks
To verify your landmarks are properly implemented:- Use a screen reader (NVDA, JAWS, VoiceOver) to navigate by landmarks
- Use browser DevTools to inspect the accessibility tree
- Use the HeadingsMap browser extension to visualize page structure
- Use axe DevTools to catch landmark issues automatically