Semantic HTML and SEO
Search engines are not people. They cannot look at your page and see that the box at the top is the menu, the big block in the middle is the article, and the strip at the bottom is the footer. They read code.
If the code is a heap of div elements, all of them look the same. If the code uses meaningful elements, the structure announces itself: this is navigation, this is the main content, this is a self-contained article, this is a footer. That is the idea behind semantic HTML.
What You Will Learnβ
- How semantic HTML helps search engines and other tools
- A fair view of what it does, and does not, do for ranking
- The key elements: header, nav, main, article, section, aside, footer
- Figures, dates, lists, and tables
- Building breadcrumbs
- How semantics, accessibility, and SEO work together
- How to check your page
The Big Ideaβ
- HTML Code
- Semantic Analyzer
<!-- Div soup: every box looks the same to a machine -->
<div class="header">...</div>
<div class="menu">...</div>
<div class="content">
<div class="title">Rye Bread</div>
<div class="date">12 March 2026</div>
</div>
<div class="footer">...</div>
<!-- Semantic: the structure is in the code -->
<header>...</header>
<nav aria-label="Main">...</nav>
<main>
<article>
<h1>Rye Bread</h1>
<p><time datetime="2026-03-12">12 March 2026</time></p>
</article>
</main>
<footer>...</footer>
Switch between the two pages, and compare what a machine can tell. Then edit the HTML yourself, and watch the results change.
Does Semantic HTML Improve Rankings?β
An honest answer: it is not a switch that boosts your ranking. Search engines have said they can understand pages without perfect markup, and they do not publish a list of "semantic bonuses." So do not expect main to lift you to number one.
But semantic HTML still matters, for solid reasons:
- It separates the main content from boilerplate. A search engine wants to index what is unique to your page, not the menu and footer repeated on every page. Clear structure makes that easier.
- It helps tools beyond search. Reader modes, translation tools, voice assistants, social previews, and AI summarisers all work better with clear structure.
- It supports accessibility, and accessible pages tend to be easier to use, which people (and search) reward.
- It makes pages easier to maintain. You and your team read the code faster.
- It prepares you for rich results. Dates, authors, breadcrumbs, and products are easier to mark up, when the basic structure is right.
You do not use semantic elements to impress a search engine. You use them to leave nothing to guesswork, for every tool that reads your page.
The Key Elementsβ
| Element | Use it for |
|---|---|
header | Introductory content for the page, or for an article or section |
nav | A set of main navigation links |
main | The central content unique to this page. Use it once. |
article | A complete, self-contained piece: a post, a recipe, a news story |
section | A themed group of content, with its own heading |
aside | Related but separate content, such as a sidebar or note |
footer | Closing content for the page, or for an article or section |
figure and figcaption | An image, chart, or code sample with a caption |
time | A date or time that machines can read |
For the details of each element, see Semantic HTML, main, article, section, nav, and aside.
Main versus boilerplateβ
Every page has boilerplate: things repeated across the site, like the logo, menu, and footer. And it has main content: the text, images, and tools that are unique to this page. Wrapping the second in main (and the first in header, nav, and footer) leaves no doubt which is which.
Article, section, or div?β
articleif you could lift it out and it would still make sense (a blog post, a product card, a comment).sectionif it is a themed part of something bigger and has a heading.divif it exists only so CSS can lay things out. That is whatdivis for, and it is fine.
Try matching jobs to elements:
Choose the best element for each job.
Some jobs have more than one reasonable answer. The point is to choose the element that matches the meaning, and to use a plain div only when nothing else fits.
Figures, Dates, Lists, and Tablesβ
Figures and captionsβ
<figure>
<img src="rye.jpg" alt="A rye loaf cooling on a wooden board" width="800" height="600">
<figcaption>Let the loaf cool fully before you slice it.</figcaption>
</figure>
A figure links an image to its caption. The caption also gives search engines more words about the image. Keep the alt text too. See Alt Text.
Dates and timesβ
<p>Published <time datetime="2026-03-12">12 March 2026</time></p>
<p>Updated <time datetime="2026-04-02T09:30">2 April 2026, 9:30</time></p>
The human-readable text can be in any language and format, while datetime is always a standard, machine-readable value. Make sure the dates are true. A page that pretends to be recently updated, when it is not, misleads readers.
Listsβ
Use ul, ol, and dl for real lists, such as ingredients, steps, and features. A list tells a machine that these items belong together, and a numbered list tells it the order matters. Do not fake a list with br tags or lines starting with a dash.
Tablesβ
Use a table for data with rows and columns, with th headers and a caption. Do not use tables for page layout. See Table Accessibility.
Quotes and emphasisβ
blockquotewithcitefor quoted material.strongfor important text, andemfor stress. These have meaning.bandiare only visual.- Do not overuse emphasis. If everything is important, nothing is.
Breadcrumbsβ
A breadcrumb trail shows where a page sits in the site: Home βΊ Recipes βΊ Rye Bread. It helps people find their way, and it gives search engines a clear picture of your site's structure. Marked up well, it can also appear in search results.
Build one, and see the HTML and the matching structured data:
Edit the trail from the home page down to the current page. The last item is the page you are on.
What people see:
Home βΊ Recipes βΊ Rye Bread
The HTML:
<nav aria-label="Breadcrumb">
<ol>
<li><a href="/">Home</a></li>
<li><a href="/recipes">Recipes</a></li>
<li aria-current="page">Rye Bread</li>
</ol>
</nav>
Matching structured data (optional):
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"name": "Home",
"item": "https://thebreadbin.example/"
},
{
"@type": "ListItem",
"position": 2,
"name": "Recipes",
"item": "https://thebreadbin.example/recipes"
},
{
"@type": "ListItem",
"position": 3,
"name": "Rye Bread",
"item": "https://thebreadbin.example/recipes/rye-bread"
}
]
}
</script>
The structured data must match the visible breadcrumb. Search engines change which rich results they show, so treat it as a helpful extra, not a promise. See the lesson on structured data. The characters are escaped so that nothing in a name can break out of the script.
Notes:
- Use
navwith a label, and an ordered list (ol), since the order matters. - Mark the last item with
aria-current="page". It is the page you are on, and often not a link. - Keep the visible trail and the structured data in step. They must agree.
- Use real links, so crawlers can follow them. See HTML SEO Basics.
Navigation and Linksβ
- Wrap menus in
nav, and give each one a label when there are several (aria-label="Main",aria-label="Footer"). - You do not need
navaround every group of links. Use it for the main blocks of navigation. - Paging and "next" links are normal
aelements. Search engines no longer use the oldrel="next"andrel="prev"hints, as far as they have publicly said, but they remain harmless, and some tools still read them. - Skip links help keyboard users. See Keyboard Accessibility.
Div Soup and Its Costsβ
A page built mostly from div and span is called "div soup." It works in a browser, but:
- A machine sees no structure.
- Screen reader users get no landmarks to jump between.
- Click handlers on divs are invisible to the keyboard, and to tools.
- CSS class names like
headerormenucarry meaning only for you. A crawler treats them as nothing in particular.
You do not need to remove every div. Just ask, for each one: is there an element that says what this really is? If so, use it.
Semantics, Accessibility, and SEO Togetherβ
The three goals pull in the same direction:
| You write | A screen reader user gets | A search engine gets |
|---|---|---|
main | A landmark to jump to | The main content |
nav with a label | A list of menus | Where the site's links are |
h1 to h6 | A way to skim by heading | The outline of the page |
time with datetime | A clear date | A machine-readable date |
button for actions | A control that works | An action, not a link |
alt text | A description | An image description |
When something is good for all three, it is usually the right thing to do. See Semantic Accessibility.
Check Your Pageβ
- Run the analyzer on your HTML. Read the notes.
- Turn off CSS. Does the page still read in a sensible order? (Browser extensions and developer tools can do this.)
- Use a screen reader or an outline tool to list landmarks and headings. Are they clear?
- Try reader mode in your browser. Does it find your main content?
- Validate your HTML with a validator, to catch broken structure.
- Check in Search Console how your pages appear.
Good Habitsβ
- Choose the element that matches the meaning.
- Use
mainonce, and wrap the page's unique content in it. - Mark menus with
nav, and label them when there are several. - Give
articleandsectiona heading. - Use
timefor dates, and make them true. - Use real lists, tables, and figures.
- Use
divandspanonly when nothing else fits. - Keep breadcrumb markup and data in step.
Semantic SEO Checklistβ
- The page has one
main - Header, nav, and footer are marked with their elements
- Each
navis labelled when there are several - Each
articleandsectionhas a heading - Dates use
timewith a correctdatetime - Images with captions use
figureandfigcaption - Lists use list elements, and data uses tables with headers
- Buttons and links are real
buttonandaelements - Breadcrumbs use
nav,ol, andaria-current - The page reads sensibly with CSS turned off
Security and Privacy Notesβ
- Do not put private data in the markup. Text in
aria-label,datetime,data-attributes, and hidden elements is visible to anyone who views the source, and to crawlers. - Escape user content. Names, comments, and titles inserted into
article,figcaption, or breadcrumb names must be escaped, or they could inject markup. In structured data, escape<as well, so nothing can close the script early. The breadcrumb demo above does this. - Make dates honest. A false "updated" date to look fresh misleads readers, and may break search guidelines.
- Do not use semantic elements to hide things from people. Structure that differs from what people see (cloaking) can lead to penalties.
- Authorship and addresses. If you mark up author names or contact addresses, ask whether those people agreed, and avoid exposing private details. Use a role or a shared address instead.
Global Audience Notesβ
- Set
langon the page, and on passages in other languages. See International SEO. timeanddatetimeuse one standard format worldwide, and the visible text can follow local custom. This is a good use of the element.- Dates and numbers differ by region (day-month-year versus month-day-year, decimal commas). Do not guess. Use
datetimefor clarity. - Breadcrumb separators should work for right-to-left languages. Let CSS draw them, and let the order of the
olstay logical. - Translated pages need translated labels, such as
aria-label="Fil d'Ariane"for a French breadcrumb. - Table, list, and quote conventions differ across languages. Check that quotation marks and punctuation follow local style.
Common Mistakes to Avoidβ
- Div soup, with no meaningful elements.
- Several
mainelements, or none. sectionorarticlewith no heading.- Using
sectionas a wrapper for styling. That is adiv's job. - Click handlers on divs instead of buttons or links.
- Dates as plain text only.
- A table used for page layout.
- Fake lists made with
bror dashes. - Several unlabelled
navelements. - Mismatched breadcrumb markup and data.
- Expecting semantic elements to boost rankings by themselves.
- Never checking the page with CSS off or a screen reader.
Practice Timeβ
Try these in your browser and your editor:
- Run the analyzer on the div-soup page, fix every suggestion, and compare it with the semantic version.
- Use the element picker. Which jobs had more than one reasonable answer?
- Build a breadcrumb for a page on a site you know, and compare the HTML with the data.
- Take a page you built, and replace five
divelements with better ones. - Turn off CSS (with developer tools or an extension). Does the page still make sense?
- Use a landmarks list (screen reader or extension). Are the regions clear?
- Mark up a date with
time, in a page that has plain-text dates. - Turn a fake list (
bror dashes) into a real list. - Open reader mode on a few pages. Which find the main content easily?
- Bonus: take a page from a site you like, copy its HTML, and rewrite it using only semantic elements. Compare the two.
Quick Recapβ
Click a question to check your answer.
1. Does semantic HTML boost rankings by itself?
No. But it makes the page unambiguous: it separates the main content from boilerplate, helps many tools, supports accessibility, and prepares you for rich results.
2. What is the difference between article and section?
An <article> is self-contained, and makes sense on its own. A <section> is a themed part of something bigger, with its own heading.
3. How many main elements should a page have?
One visible <main>, holding the content unique to the page.
4. Why use the time element?
Its datetime attribute gives machines a standard, reliable date, while the visible text can be in any local format.
5. What are the parts of a good breadcrumb?
A labelled <nav>, an ordered list of links, the current page marked with aria-current="page", and, optionally, matching structured data that agrees with the visible trail.
6. Why avoid div soup?
A machine sees no structure, screen reader users get no landmarks, and clickable divs do not work with a keyboard. Use meaningful elements wherever one fits.
Key Takeawaysβ
- Semantic elements put the page's structure in the code.
- They do not boost ranking by themselves, but they remove guesswork for every tool.
- Use
main,nav,header,footer,article,section, andasidefor what they mean. - Use
time,figure, lists, and tables for dates, captions, lists, and data. - Use
divandspanonly when nothing else fits. - Build breadcrumbs with
nav,ol, andaria-current. - Semantics, accessibility, and SEO all pull the same way.
- Keep markup honest, and escape user content.
Next, learn how to tell search engines which version of a page is the main one, in Canonical Links.