The fast rule
Pick an element for what the content is, not how it looks.
Semantic elements describe the role of content. CSS controls its appearance. That separation makes a document easier to navigate, maintain, and interpret without forcing a particular visual design.
Start by asking what job a block performs. Is it the page’s unique content? Use <main>. Could it stand alone? Try <article>. Is it one named topic within something larger? Consider <section>. If the wrapper has no content meaning, <div> remains the honest choice.
Quick reference
Eight tags and the job each one does.
The common fork
Article, section, or div?
These elements can all wrap a block, but they do not communicate the same thing. Use the smallest decision that fits the content.
- 01
Could this content stand on its own?
If it still makes sense in a feed, search result, or another page, use
<article>. - 02
Can a heading name this part?
If it is one distinct topic inside a larger document, use
<section>. - 03
Is the wrapper only for layout or behavior?
If it has no content role of its own, use
<div>.
Complete example
A small page with a clear reading order.
Read the structure without the CSS. The element names still tell you where the page begins, what matters most, what can stand alone, and what is supplementary.
<body>
<header>
<a href="/">Field Notes</a>
<nav aria-label="Primary">
<a href="/guides">Guides</a>
<a href="/about">About</a>
</nav>
</header>
<main>
<article>
<header>
<p>HTML foundations</p>
<h1>How landmarks shape a page</h1>
</header>
<section aria-labelledby="why-landmarks">
<h2 id="why-landmarks">Why landmarks matter</h2>
<p>They give each region a recognizable job.</p>
</section>
<aside aria-labelledby="quick-check">
<h2 id="quick-check">Quick check</h2>
<p>Can you find the page’s unique content?</p>
</aside>
<footer>
<p>Written by the Field Notes team.</p>
</footer>
</article>
</main>
<footer>
<p>© Field Notes</p>
</footer>
</body>1The site header and site footer sit outside main because they repeat across pages.
2The article has its own header and footer because both describe that self-contained story.
3The section and aside each have a heading, so their purpose stays clear in the document outline.
Before you ship
Review the page in six checks.
A semantic page should make sense before its colors, columns, and spacing load. Use these checks on the HTML itself.
- 01
One visible main
The page has one main element around its unique content, outside the repeated site header and footer.
- 02
A logical heading outline
The h1 names the page, and lower-level headings describe nested topics without jumping levels for visual size.
- 03
Navigation earns its landmark
Nav wraps a meaningful route or table of contents, not every cluster of links.
- 04
Articles can stand alone
Each article makes sense if it appears in a feed, search result, or another page.
- 05
Sections have names
Each section represents a real topic and normally begins with a heading that identifies it.
- 06
Generic wrappers stay generic
Div and span handle layout or styling when no semantic element describes the content’s job.
Want to apply the reference to a real page? Build a saved semantic HTML article in the focused lesson.
Short answers
Semantic HTML FAQ
What is semantic HTML?
Semantic HTML uses elements whose names describe the role of their content. A main element communicates more than a generic div because its purpose is built into the markup.
Should I use section or div?
Use section for a named topic within a larger document, usually with its own heading. Use div when you only need a neutral wrapper for layout, styling, or scripting.
Can an article contain sections?
Yes. An article can contain sections when each section covers a distinct part of that self-contained article. A section can also contain articles when it groups several independent entries under one theme.
Does semantic HTML improve SEO?
It helps search engines and assistive technology understand page structure, but it does not guarantee rankings. Useful content, crawlability, links, and a clear answer to the search query still matter.