Skip to content

Semantic HTML: header, nav, main, article, section, aside and footer (with Examples)

NeedMyTools Academy

Sign in free to read the full lesson

Sign in or create a free account

Free forever. No card, no paywall.

Two pages can look identical and still be built very differently. One is a pile of <div> boxes; the other says "this is the site header, this is the navigation, this is the main content, this is a related sidebar". The second one lets a screen reader user jump straight to the content, helps search engines find the main text and is much easier for the next developer to change.

Quick answer

Use <header> for the site or section intro, <nav> for main navigation links, one <main> for the page’s main content, <article> for a self-contained piece such as a post, <section> for a themed part with a heading, <aside> for related side content and <footer> for the closing information. Use <div> only when no element has the right meaning.

20 min read and practice · Content checked on 20 October 2026

In this lesson you will

  • Lay out a full page with landmark elements
  • Choose between article, section and div
  • Explain how landmarks help screen reader users

Landmarks: the map of a page

Some elements create landmarks, regions that assistive technology lists so users can jump to them. A <header> that is not inside an article or section becomes the "banner" landmark, <nav> is "navigation", <main> is "main", <aside> is "complementary" and a top-level <footer> is "contentinfo". Screen readers such as NVDA and VoiceOver have keys to move between landmarks.

A page should have exactly one visible <main>. Put the content that is unique to this page in it, and keep repeated parts, such as the site header and footer, outside. Many sites also add a "Skip to content" link at the very top that points to #main; keyboard users then skip the menu with one key press.

Try it: A full page skeleton with landmarks
Code
ResultUpdates as you type
Console
  1. Console messages, errors, form data and clicked links appear here.

The result looks plain because there is no CSS yet. The structure is what matters here; the CSS course styles this same page.

Sign in free to read the full lesson

You are reading the free preview. Create a free account (it takes one minute, no password) to unlock the rest of this lesson and track your progress.

Unlocks after sign-in:

  • 2 more sections with live code examples
  • Common mistakes to avoid
  • Hands-on coding exercise with automatic checks
  • Practice quiz and the graded lesson test
Sign in or create a free account

Free forever. No card, no paywall.

Questions people ask

Does semantic HTML improve Google rankings?

Google does not promise a ranking boost for any element. Semantic markup helps it understand which text is the main content, and it improves accessibility and reading modes, which is reason enough.

Can I have a header inside an article?

Yes. A <header> inside an article or section is that part’s intro, usually its heading and byline. Only the top-level header becomes the page banner landmark.

Is every group of links a nav?

No. Use <nav> for major navigation blocks such as the main menu, a table of contents or pagination. A few links inside a paragraph or a list of related articles do not need it.

What is ARIA and should I use it here?

ARIA attributes add accessibility information that HTML cannot express. The first rule of ARIA, from W3C, is to use a native HTML element when one exists, so prefer <nav> to <div role="navigation">.

How can I see the landmarks of a page?

Browser developer tools show the accessibility tree (in Chrome and Edge, open DevTools, then the Accessibility pane), and free extensions list landmarks. Screen readers also have a landmarks list.

Sources

Facts in this lesson were checked against these official pages on 20 October 2026.

Code examples stay in English and run in a sandbox on your device. If you spot a mistake, tell us through the contact page.