Why meaning matters
"Semantic" means "about meaning". Compare these two pieces of HTML. They can look identical on screen:
<div class="top"><div class="links">...</div></div>
<header><nav>...</nav></header>
The second tells a screen reader "this is the site header and its navigation", so a blind visitor can jump straight to it or skip past it. Search engines also use these elements to find the main content of a page.
The main page landmarks
<header>: introductory content, such as the logo and site name. Also usable at the top of an article.<nav>: a block of main navigation links.<main>: the main content of the page. Use it once per page.<aside>: related but separate content, such as a sidebar or a "did you know?" box.<footer>: closing information, such as contact details and copyright.
article or section?
<article>is content that would still make sense on its own: a blog post, a news story, a forum post, a product card.<section>is a themed part of something bigger, and it should normally start with a heading.<div>has no meaning. It is still the right choice when you only need a box for styling.
Quick test: if you could put it in an RSS feed or share it alone, use article; if it is a chapter of the page, use section; if it is just for layout, use div.
A complete page
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Class 8A Science Blog</title>
</head>
<body>
<header>
<h1>Class 8A Science Blog</h1>
<nav aria-label="Main">
<a href="#posts">Posts</a>
<a href="#about">About</a>
</nav>
</header>
<main id="posts">
<article>
<h2>Growing beans in the dark</h2>
<p><time datetime="2026-11-20">20 November 2026</time></p>
<section>
<h3>What we did</h3>
<p>We planted six beans: three by the window and three in a cupboard.</p>
</section>
<section>
<h3>What we found</h3>
<p>The beans in the dark grew taller but pale and weak.</p>
</section>
</article>
</main>
<aside id="about">
<h2>About this blog</h2>
<p>Written by the students of Class 8A.</p>
</aside>
<footer>
<p>Contact our teacher at school.</p>
</footer>
</body>
</html>
<time datetime="..."> gives the date in a format computers can read, while showing a friendly date to people.
Headings form the outline
Screen reader users often move through a page by its headings, like a table of contents. Keep the levels in order: one h1 for the page, h2 for its main parts, h3 inside those. Do not skip from h2 to h5 because you like the size; change the size with CSS instead. Browser extensions such as "HeadingsMap" show a page's outline so you can check it.
Try it yourself
Open the complete example in Unays Code and add a second article with its own sections. Then take an old page you built from divs and replace them with the right landmarks. Continue with web accessibility basics.
This tutorial was written with AI assistance and reviewed by Unays. The runnable code examples were tested before publishing. Spotted a mistake? Tell us at [email protected].