TetSharing
HTML tutorial · 12 chapters
  1. Get started
  2. Elements and attributes
  3. Headings and paragraphs
  4. Text formatting
  5. Links
  6. Images
  7. Lists
  8. Tables
  9. Forms
  10. Input types and controls
  11. Semantic layout
  12. Head and metadata

Final HTML quiz

Chapter 11 of 12 · By Ethan Cole · Updated November 21, 2026

Semantic HTML: header, nav, main, article, footer

A page built entirely from <div> elements can look perfect and still be a puzzle for anyone who cannot see it. Semantic elements say what each region of a page is for. Browsers, screen readers, reading modes and search engines all use that information.

The main landmarks

  • <header> holds introductory content: usually the logo, site name and main navigation at the top of the page. An article can have its own header too.
  • <nav> wraps a major block of navigation links. Not every group of links needs it; reserve it for the main menu, a table of contents, or breadcrumbs. When a page has several, give each an aria-label such as "Main" or "Breadcrumb".
  • <main> contains the page's primary content. There should be one visible <main> per page, and it should not include the repeated header and footer.
  • <footer> holds closing information: copyright, contact links, related pages.
  • <aside> is content that is related but secondary, such as a sidebar or a "related lessons" box.

Screen readers expose these as landmarks, so a user can jump straight to the navigation or to the main content instead of listening to everything in order.

HTML · editable

Expected page text

TetSharing
Python | SQL
Why semantic HTML matters
Landmarks let screen-reader users jump straight to the content.
Search engines
Clear structure helps crawlers understand the page.
Related: HTML headings
© 2026 Example Co.

article and section

<article> is a self-contained piece that would make sense on its own, for example in a feed reader: a blog post, a news story, a product card, a comment. <section> groups a thematic part of a document and normally starts with a heading. If you cannot think of a heading for it, you probably want a <div>.

Where div still fits

<div> has no meaning at all, which is exactly what you want for a wrapper that exists only for styling, such as a grid container. Use <div> freely for layout; use semantic elements for meaning. The same goes for <span> inside text.

Why it helps search engines

Semantic structure does not boost rankings by itself, but it helps crawlers find the main content, separate it from navigation and boilerplate, and understand the page's headings. Combined with a clear heading outline, it is part of making a page easy to interpret.

Common mistakes

  • Wrapping every block in <section> without headings.
  • Several visible <main> elements on one page.
  • Putting the main content inside <aside> or the site navigation inside <main>.

Summary

  • header, nav, main, aside and footer mark page regions and become landmarks.
  • article is self-contained content; section is a themed part with a heading.
  • div and span remain the right choice for meaningless wrappers.

Quiz: Semantic layout

1. How many visible <main> elements should a page have?

One <main> marks the primary content of the page.

2. Which element suits a blog post that could be syndicated on its own?

An article is self-contained content.

3. What is <div> best used for?

div carries no meaning, which makes it right for purely presentational wrappers.

Official docs

Written under the pen name Ethan Cole with AI-assisted drafting. Every code example on this page is executed by our test suite before publishing. Found a mistake? Tell us.