Semantic HTML: Meaningful Markup for Accessibility
Also called: Semantic markup, Meaningful markup, POSH
Definition
Semantic HTML means marking up content with the elements that describe its meaning, such as h1–h6, nav, button or table. It lets assistive technology understand structure and relationships, as WCAG 1.3.1 requires.
Semantic HTML means choosing each element for what the content is, not for how it should look: a heading is an h2, a list is a ul, a button is a button. Browsers pass that meaning on to screen readers, voice control and search engines. A page built only from styled div elements may look the same, but to assistive technology it is a flat stream of text.
What it means
Semantic markup is the main way to meet WCAG 1.3.1 Info and Relationships, a Level A criterion of WCAG 2.2. It requires that information, structure and relationships conveyed through presentation can be programmatically determined or are available in text. If something looks like a heading, a list, a table or a field label, the code has to say so too – see info and relationships.
W3C's sufficient techniques for 1.3.1 are mostly plain HTML elements:
| Visual structure | Semantic HTML | W3C technique |
|---|---|---|
| Headings | h1–h6 |
H42 |
| Lists and groups of links | ul, ol, dl |
H48 |
| Data tables | table, th, caption, scope |
H51, H39, H63 |
| Field labels | label for="…" |
H44 |
| Page regions | header, nav, main, footer |
H101 |
The failures are the reverse: changing text presentation to convey information without markup (F2), using structural markup that doesn't match the relationships (F43), and role="presentation" on content that has meaning (F92). W3C also lists F42 – a span or div made to act like a link with a script.
Who benefits: screen reader users, who jump between headings, landmarks and lists; keyboard users, who reach native controls without extra code; and voice control users, who say "click Send" and need a real button with that name.
Examples
The same card, once built from generic boxes and once with semantic elements:
<!-- Without semantics: looks fine, means nothing -->
<div class="title">Our services</div>
<div class="item">Web design</div>
<div class="item">Hosting</div>
<div class="btn" onclick="send()">Send request</div>
<!-- Semantic HTML: same look with CSS, real structure -->
<section aria-labelledby="services">
<h2 id="services">Our services</h2>
<ul>
<li>Web design</li>
<li>Hosting</li>
</ul>
<button type="button" onclick="send()">Send request</button>
</section>Pick elements by meaning and style them with CSS. Use one main, a nav for menus and a logical heading structure. Mark up data tables with th and captions. Use a href for navigation and button for actions.
Build headings from bold text, lists from line breaks or buttons from divs. Use tables for layout. Skip heading levels to get a smaller font. Add ARIA roles to fix markup you could simply replace with the right element.
How to check semantic HTML
Questions
What is semantic HTML in simple terms?
Using the HTML element that matches what the content is: h1 for the main heading, nav for navigation, button for a button. The element carries meaning that browsers and assistive technology can read, independent of the visual design.
Why is semantic HTML important for accessibility?
Screen readers announce elements by their role and let users jump by headings, landmarks and lists. Without semantic markup, that structure exists only visually, so WCAG 1.3.1 fails and people who cannot see the layout lose orientation.
Is a div with an ARIA role as good as a native element?
It can be made equivalent, but only if you add focus handling, keyboard support and states yourself. Native elements bring all of this, so the usual rule is to use HTML elements first and ARIA only where no element fits.
Does semantic HTML help SEO?
Search engines use headings, lists and landmarks to understand a page, and clean markup makes content easier to extract. Accessibility is the stronger reason, though: it decides whether people can use the page at all.
How can I find markup problems on my website?
The accessibility tree in DevTools shows what assistive technology sees. For a quick overview, the free WCAG scanner checks your homepage for issues like missing labels and heading errors.
Related terms
Info and Relationships: Structure in the Code
Info and Relationships is WCAG success criterion 1.3.1: information, structure and relationships conveyed through presentation can be programmatically determined or are available in text.
Read definition: Info and Relationships: Structure in the CodeHeading Structure: Build a Clear Page Outline
Heading structure is the outline a page forms through its h1 to h6 elements. Each heading marks the start of a section, and its level shows where that section sits in the hierarchy.
Read definition: Heading Structure: Build a Clear Page OutlineARIA Landmarks: Page Regions for Screen Readers
ARIA landmarks are roles such as banner, navigation, main and contentinfo that identify the large regions of a page. Screen readers list them and let users jump directly to each region.
Read definition: ARIA Landmarks: Page Regions for Screen ReadersARIA: Roles, States and Properties Explained
ARIA (WAI-ARIA, Accessible Rich Internet Applications) is a W3C specification of HTML attributes – roles, states and properties – that tell assistive technology what a custom element is, what it is called and what state it is in.
Read definition: ARIA: Roles, States and Properties Explained