Full answer
These elements all group content, but they carry different meaning.
articleis a self-contained piece that makes sense on its own and could be shared or reused: a blog post, a news story, a product card in a list, a comment. A test is whether it would still make sense in a feed or an email.sectionis a thematic group of content, usually with a heading. It is part of a larger whole, such as "Pricing" and "Reviews" on a page. Asectionwithout a heading or a name is just adivwith extra words. With an accessible name (for examplearia-labelledbypointing to its heading), it becomes aregionlandmark for screen reader users.asideis content that is related to the main content but could be removed without breaking it: a sidebar, a pull quote, a box of related links. It is acomplementarylandmark.divhas no meaning. Use it when you need a box for styling or scripting and no other element fits.
Other points:
- Do not use
sectionjust to apply CSS. Usedivfor that. - Each
articleandsectionshould usually have a heading, so a user who moves by headings can understand the page. - Pick the element by meaning, then style it. The correct element can give you landmarks for free, and too many unnamed landmarks make navigation noisy.
- Use
header,footer,navandmainfor page-level parts.headerandfooterinside anarticleorsectionare not page-level landmarks.
The post is an article that can stand alone. The Basics block is a named section, so it appears as a region. The related links are an aside, which screen readers list as complementary content. The last box is a plain div because it has no meaning.
Check the outline with a landmarks list in a screen reader or browser tools.
html
<main>
<article id="post">
<h1>Learning HTML</h1>
<section id="s1" aria-labelledby="h-basics"><h2 id="h-basics">Basics</h2><p>Tags and attributes.</p></section>
<aside id="side"><h2>Related</h2><a href="#">CSS guide</a></aside>
<div class="box">Only for styling</div>
</article>
</main>Run in Chrome 156 (headless) as a page; the snippet is wrapped in a minimal HTML document with doctype, charset and viewport meta tag. Two full runs gave identical results, and the measured values in the answer come from them.
Key points
- article stands on its own.
- section groups a theme and needs a heading.
- aside is related, removable content.
- div carries no meaning; use it for styling.
- Name a section to make it a region.
Common mistakes
- Using section for every wrapper because it sounds semantic.
- Using article and section with no headings.
- Adding many landmarks with no names, which makes navigation noisy.
Follow-ups
- What makes a section a region landmark?
- Is a header inside an article a page-level banner?
Tips
- State the meaning of each in one line, and say div means none.
- Give the self-contained test for article.