Mental model

Semantic HTML

Using HTML elements that describe their meaning to build an accessibility tree that screen readers use to navigate web content efficiently.

Discover

When a blind user opens a webpage, their screen reader needs to understand the page structure to help them navigate. Put these steps in the correct order:

How do browsers and screen readers work together?

See how semantic HTML powers this entire pipeline.

Understand

Understand

Semantic HTML means using elements that describe what they are, like <button>, <nav>, and <main> instead of generic boxes like <div>. When browsers receive your HTML, they build an accessibility tree based on these element meanings, then screen readers use that tree to announce content and let users jump between sections. A properly structured page lets someone navigate from a menu directly to the main content, rather than listening to every element in order. Try this: Open any webpage and inspect the HTML to see whether it uses semantic elements like <nav> and <main> or generic containers like <div>.

Full explanation

Full explanation

When you write HTML, you're not just telling browsers how things should look—you're describing what each part of your page is. This description creates a map called the accessibility tree, which assistive technologies rely on.

The process works like this: First, your HTML markup arrives at the browser. The browser transforms it into the DOM (Document Object Model), then uses the semantic meaning of your elements to build an accessibility tree containing four key pieces of information for each element: its name (how it's referred to), role (what kind of thing it is—button, link, navigation), state (checked, expanded, collapsed), and what actions are possible. Platform accessibility APIs then pass this information to screen readers and other assistive technologies.

Semantic elements serve as landmarks that screen reader users can jump between. For example, <header> creates a banner landmark for site-wide content like logos, <nav> marks navigation regions, <main> identifies the primary content, <article> contains self-contained content like blog posts, <aside> holds related content like sidebars, and <footer> creates a contentinfo landmark for copyright and site information. When you use these elements, users can bypass repetitive navigation and go straight to what they need.

In an e-commerce site, semantic HTML lets a shopper skip directly from the product search results to the filters, then to the checkout button—without tabbing through dozens of unrelated links. On a news site, a reader can jump straight to the main article, bypassing header ads and navigation menus. On a social media platform, users can navigate between posts in their feed using semantic article boundaries, then jump directly to the comment section or like button within each post.

Using the right element matters: a <button> gets keyboard support and focus behavior automatically, while a clickable <div> requires extra JavaScript and ARIA attributes to function the same way. Form inputs with proper <label> elements announce their purpose clearly, while unlabeled inputs might only read as "edit text" with no context. Headings (<h1> through <h6>) create a document outline that many screen readers display as a table of contents—this is why heading levels should never be skipped and should follow logical order.

Research

Research

Research shows that semantic structure significantly impacts screen reader navigation efficiency. Personalized table-of-contents navigation has been shown to reduce task completion time and improve user satisfaction. [1]

WebAIM's 2024 Screen Reader Survey reveals that 71.6% of screen reader users navigate by headings as their primary method for finding information on lengthy pages, while 88.8% find heading levels very or somewhat useful. However, only 31.8% frequently use landmark navigation, suggesting inconsistent implementation limits their utility. [2]

De Vries (2019) explains that the accessibility tree transforms DOM elements into assistive technology-friendly objects with name, role, state, and description properties. The transformation depends entirely on semantic HTML elements—elements with display: none are removed from the accessibility tree entirely, and CSS visual reordering can create mismatches between what users see and what assistive technologies encounter. [3]

Limitations

Limitations

Semantic HTML has important limits. Not all screen users encounter the accessibility tree consistently—browser implementations vary, and some attributes compute differently across platforms. CSS display: none removes elements from the accessibility tree in most browsers, but visibility: hidden behavior differs. Complex widgets like custom dropdowns, tabs, and auto-complete fields often require ARIA attributes to supplement native semantics because HTML lacks equivalent elements. Landmark navigation, while valuable, remains underutilized: WebAIM's survey found only 3.7% of users primarily navigate by landmarks, despite 31.8% using them frequently when available. This suggests either inconsistent implementation or competing navigation strategies like headings (used by 71.6%) remain more reliable.

Try it

Synthesize

Choose a pattern from the guide, then pick an action to try with it.

Which pattern stands out?

What will you try?

Choose a pattern above to select an action.

Sources

Sources

Try it

Check your understanding

A developer creates a 'Play Video' button using `<div onclick='playVideo()'>Play Video</div>`. Why does this create an accessibility problem, and what is the correct approach?

Show the guide's explanation

Answer: Divs cannot receive keyboard focus, so screen reader users cannot activate the button with Enter/Space. Replace with `<button>Play Video</button>`.

The `<button>` element provides built-in keyboard accessibility—users can tab to it and press Enter or Space to activate. A `<div>` has no default keyboard behavior, so you would need to add `tabindex='0'`, `role='button'`, and JavaScript keyboard event handlers to recreate functionality that comes free with a proper button. Semantic HTML gives you accessibility support for free.

Which sequence of HTML elements correctly creates a page structure that screen readers can navigate as landmarks?

Show the guide's explanation

Answer: <header><nav><main><footer>

This sequence uses semantic HTML elements that create landmark regions: `<header>` (banner), `<nav>` (navigation), `<main>` (main content), and `<footer>` (contentinfo). Screen readers can jump directly to these regions. The first option uses a non-standard `<logo>` element. The second uses generic `<div>` elements, which don't create landmarks. The fourth places `<nav>` before `<header>`, which is atypical—navigation usually appears within or after the header, not before it.

A screen reader user is on a product page and wants to jump directly from the search results list to the price filters without navigating through every result. Which semantic element makes this possible?

Show the guide's explanation

Answer: <aside id='filters' aria-label='Price filters'>

The `<aside>` element creates a landmark region that screen readers can jump to directly. Adding `aria-label` gives it a meaningful name, so users hear 'Price filters, complementary landmark' when they navigate to it. While `<section>` can be semantic, it's only exposed as a landmark if it has an accessible name via aria-label or aria-labelledby. The `<div>` and `<span>` elements are generic and don't create landmarks at all, meaning the user would have to navigate through every search result to reach the filters.

Keep exploring

Find another idea for the decision in front of you.

The complete Reframo library is free to read. Explore another guide whenever you are ready.