Sub topic 5
section versus article
This chapter assumes you know the landmark elements (header, nav, main, aside, footer) and how heading levels work. You should also be able to inspect an element's role in your browser's accessibility panel.
Two elements, two questions
article and section both group content under a heading, which is why they get confused. They answer different questions.
articleasks whether the content still makes sense if you lift it out of the page. A blog post, news story, product card, forum post or user comment passes this test. You could syndicate it in a feed and nothing would be lost.sectionasks whether the content is a themed part of something larger. A "Key points" block inside a post, or the chapters of a long guide, are sections. On its own, a section usually loses context.
If neither question fits, you probably want a div.
<article>
<h2>Why semantics matter</h2>
<p>Published <time datetime="2026-11-30">30 November 2026</time> by Sam Lee.</p>
<section>
<h3>Key points</h3>
<ul>
<li>Elements describe content.</li>
<li>CSS controls appearance.</li>
</ul>
</section>
<section>
<h3>Further reading</h3>
<p>See the chapter on landmarks.</p>
</section>
</article>The post is an article. Its two parts are section elements, and each one has a heading.
What assistive technology sees
The two elements behave differently in the accessibility tree.
| Element | Exposed role | Notes |
|---|---|---|
| `article` | `article` | Always exposed. Screen readers can jump between articles. |
| `section` | `region` | Only when it has an accessible name. Otherwise it is a generic group. |
To make a section a navigable landmark, name it with aria-labelledby pointing at its heading.
<section aria-labelledby="pricing-title">
<h2 id="pricing-title">Pricing</h2>
<p>Plans start at $5 per month.</p>
</section>Common errors
- Using
sectionas a styling wrapper. If the only reason is a background color or a flex container, usediv. - Sections without headings. A section with no heading is a sign it should be a
div. - Wrapping the whole page in
article. Usemainfor the primary content. Usearticlefor each self-contained item inside it. - Naming every section. Each named section becomes a region landmark. Too many landmarks make navigation noisy, so name only the important ones.
- Splitting a post's comments badly. Each comment is its own
article, nested inside the post'sarticle. The nesting shows that the comments belong to the post.
Exercise
A shop's product listing page shows twelve product cards. Each card has a name, photo, price and "Add to cart" button. Which element should wrap each card, and what should wrap the whole list of cards?
Show answer
Wrap each card in an article, because a card is self-contained and could be reused elsewhere, such as in search results. Wrap the list of cards in a section with a heading like "Products", or in a ul if the cards are a simple list. Use a div only if you need a purely visual wrapper with no heading.