Glossary
/
Semantic HTML

Semantic HTML

What is semantic HTML?

Semantic HTML is the practice of using HTML elements according to their meaning, such as <header>, <nav>, <main>, <article>, and <footer>, rather than relying on generic containers like <div> and <span> where a more meaningful element exists. By doing so, you communicate the purpose of your content directly through the markup, helping screen readers and other assistive technologies, as well as search engines, understand a page's structure.

At a glance

Category Detail
Type HTML markup practice
Related standard HTML Living Standard (WHATWG); WCAG 2.2 Success Criterion 1.3.1
Common aliases Semantic markup, semantic elements, HTML semantic tags
Related terms Screen reader, Assistive technology, WAI-ARIA

Why is semantic HTML important when it comes to accessibility?

Screen readers and other assistive technologies don't interpret a web page the same way a sighted user does. They rely on the browser's accessibility tree, which exposes information from the HTML about what each piece of content is and how it works.

A <nav> element is exposed as a navigation landmark, whereas a styled <div> doesn't provide that landmark automatically.

Screen reader users often jump straight to the region they need, such as the main content or the navigation links, rather than listening to an entire page read out in order – a shortcut generated by good semantic HTML.

Without meaningful landmarks and headings, screen reader users have fewer shortcuts for finding the content they need. Keyboard-only users also benefit from semantic HTML, especially native interactive elements like <button> and <a>, which support keyboard navigation without additional JavaScript.

Search engines like Google, and the web crawlers behind them, read the same structure for a different reason: to tell a genuine heading and the real page content apart from boilerplate like navigation and footers.

A single set of tags serves both audiences, carrying context and functionality that CSS alone can't provide. Semantic HTML sits at the center of both accessibility and SEO best practices.

How does semantic HTML work?

Many semantic HTML elements have implicit roles that browsers expose to assistive technologies automatically, without requiring additional ARIA attributes.

  • A <nav> has the implicit role of navigation.
  • A <main> has an implicit role of main.
  • A <button> has an implicit role of button, plus keyboard behavior and focus handling.

Assistive technologies read these implicit roles straight from the accessibility tree.

Non-semantic elements don't provide meaningful roles by default. A <div> can contain accessible text, but it doesn't tell a screen reader whether that content represents navigation, a heading, or another specific element.

CSS can change how an element looks, but it doesn't change its semantic meaning. As a developer, avoid using a <div> by default when there's already a semantic element that matches the content's purpose.

Heading elements work the same way. A logical hierarchy of <h1> through <h6> tags creates a structure that screen reader users can navigate heading by heading. Style a <span> to look identical to a heading, and it won't provide the same navigation shortcut, even though the page looks the same to a sighted visitor.

Semantic HTML covers more than layout. Sectioning elements include <article>, <aside>, <nav>, and <section>, while <header>, <main>, and <footer> describe other parts of a page.

There are also elements for

  • Specific content types, like <figure> and <figcaption> for self-contained content with captions, <time> .
  • For dates and times.
  • For highlighting relevant text, like <mark>.

Images that convey information require meaningful alt text, while decorative images should use alt="". Wrapping an image in <figure> with a <figcaption> also lets you associate it with a caption that provides additional context.

Semantic HTML example

The two snippets below contain the same page content and can be styled to look similar. However, the semantic version provides landmarks and heading information that assistive technologies can use to help people navigate the page.

Non-semantic HTML, built entirely from generic containers:‍

<div class="header">
  <div class="nav">
    <a href="/">Home</a>
    <a href="/blog">Blog</a>
  </div>
</div>
<div class="content">
  <div class="title">How semantic HTML helps accessibility</div>
  <div class="body">...</div>
</div>
<div class="footer">© 2026 Example Co.</div>

‍The same page content, rewritten with semantic HTML:‍

<header>
  <nav>
    <a href="/">Home</a>
    <a href="/blog">Blog</a>
  </nav>
</header>
<main>
  <article>
    <h1>How semantic HTML helps accessibility</h1>
    <p>...</p>
  </article>
</main>
<footer>© 2026 Example Co.</footer>

‍In the second version, the markup identifies the navigation, main content, and footer as landmarks, and the page title as a heading. Screen reader users can navigate directly to these elements.

The first version still contains accessible links and text, but it doesn't provide those same landmark and heading shortcuts.

Semantic HTML vs. non-semantic HTML

Semantic element Non-semantic equivalent What the semantic element tells browsers and assistive tech
<header> <div class="header"> Introductory content for a page or section
<nav> <div class="nav"> A block of navigational links
<main> <div id="main"> The page's primary, unique content
<article> <div class="post"> Independent, self-contained content
<footer> <div class="footer"> Closing content for a page or section

You can still use non-semantic elements. <div> and <span> provide generic grouping for styling or scripting hooks that carry no particular meaning.

The mistake is using them when another element would better describe the content. Before using a <div> or <span>, ask what the content represents: navigation, a heading, a button, or simply a wrapper for styling. Choose a semantic element when it matches the content's purpose.

Common mistakes or misconceptions

  • Using a semantic tag purely as a styling hook. If you wrap an unrelated block in <article> just because it feels more important, rather than because it's genuinely independent, self-contained content, you've broken the whole point of the element.
  • Adding multiple visible <main> elements, or skipping <main> entirely. A page should have one main landmark that assistive-technology users can navigate to directly. Multiple exposed main landmarks, or none at all, make that navigation less useful.
  • Treating ARIA as a patch for bad markup. Native interactive elements like <button> have built-in roles, keyboard behavior, and focus handling. Adding role and other ARIA attributes to a <div> can convey some of the same meaning, but it won't recreate behavior like a button's native keyboard activation. Recreating that behavior requires additional code and maintenance. Incorrect ARIA attributes are among the common website accessibility issues that automated scanners can flag.
  • Using <section> everywhere as a generic wrapper. A <section> represents a thematic grouping of content and should usually have its own heading. If you're only grouping elements for styling, use a <div> instead. When a section needs to act as a navigation landmark, give it an accessible name.

Frequently Asked Questions

How do I convert a website to semantic HTML?

Audit the page template by template: find each <div> and <span> standing in for a header, navigation, main content, articles, or a footer, and swap in the matching semantic element.

‍

Confirm there's one visible <main> and, as a best practice, one <h1> per page. Then inspect the accessibility tree, run automated checks like Marker.io's accessibility checks, and test the page with a keyboard before moving to the next template.

‍

Changing HTML tags can affect existing CSS. For example, headings and paragraphs have different default styles from <div>, and CSS selectors targeting specific elements may no longer apply. Check the layout and styling after each change.

Which semantic HTML tags improve accessibility most?

Landmark elements like <nav>, <main>, and <aside> help screen reader users jump to important regions. Page-level <header> and <footer> elements also provide landmarks.

‍

Screen reader users can navigate from section to section more easily with a logical heading hierarchy.

‍

Native interactive elements like <button> and <a> provide built-in keyboard behavior that a styled <div> doesn't. The <label> element also improves accessibility by associating text with form controls.

What's the best semantic HTML structure for a blog article?

Wrap the whole post in <article>, with a <header> holding the <h1> title and a <time> element for the publish date. Break the body into <section>s, each with its own heading, add an <aside> for related links or a pull quote if needed, and close with a <footer> for author details or tags.

‍

You can scale this to a full blog index page: each post preview becomes its own <article> inside a shared <main>, rather than one long list of divs.

How does semantic HTML affect SEO rankings?

Semantic HTML doesn't guarantee higher search rankings, but it helps search engines understand how a page's content is organized. Elements like headings and landmarks provide context about the content and its purpose.

‍

Search engines can interpret non-semantic HTML, too, so semantic markup isn't a requirement for indexing, featured snippets, or AI-generated search results. Its clearest benefit is making content easier for people and assistive technologies to understand and navigate.

Try our website monitor free

Automate website monitoring tasks
and keep your pages compliant