Skip to main content
πŸ“œ WAYPOINT LESSON

Semantic HTML & Page Structure

⭐ beginner⏳ 12 min readπŸ“ Lesson 11 of 143

Give every part of your page a meaningful name with header, nav, main, section, article, aside, and footer.

So far your pages have been a heading and some paragraphs. Real pages have regions β€” a banner, navigation, the main content, a footer β€” and HTML has an element for each. These are semantic elements: their names describe their role.

Why semantics matter

Compare two ways to mark up a page:

<!-- meaningless: a browser knows nothing -->
<div class="top">…</div>
<div class="menu">…</div>
<div class="content">…</div>

<!-- meaningful: a browser knows the roles -->
<header>…</header>
<nav>…</nav>
<main>…</main>

To the browser β€” and to screen readers, search engines, and reader modes β€” these are not the same. With semantics, a screen-reader user can jump straight to <main> and skip the navigation; a search engine understands what the page's primary content is. <div> is the honest choice when no meaning applies β€” but it is the last resort, not the default.

The structural elements

  • <header> β€” introductory content for the page or a section: logo, site name, tagline.
  • <nav> β€” major navigation: a group of links for moving around the site. Not every group of links is a nav β€” footers with legal links usually are not.
  • <main> β€” the page's primary content. Exactly one per page, and it must not be nested inside other structural elements. Screen readers jump here first.
  • <section> β€” a thematic grouping with its own heading ("Courses", "Testimonials"). If you cannot give it a heading, it probably is not a section.
  • <article> β€” content that is complete and independently meaningful: a blog post, a product card, a single review.
  • <aside> β€” tangential content: related links, a pull quote, a sidebar.
  • <footer> β€” closing content: copyright, contact, small print.

A typical page skeleton:

<body>
  <header>
    <h1>Ada's Bakery</h1>
  </header>
  <nav>
    <ul>
      <li><a href="#bread">Bread</a></li>
      <li><a href="#cakes">Cakes</a></li>
    </ul>
  </nav>
  <main>
    <section id="bread">
      <h2>Bread</h2>
      <p>Sourdough daily.</p>
    </section>
    <section id="cakes">
      <h2>Cakes</h2>
      <p>To order on Fridays.</p>
    </section>
  </main>
  <footer>
    <p>Β© 2026 Ada's Bakery</p>
  </footer>
</body>

Note the id attributes on the sections β€” combined with the #bread links in the nav, clicking a nav link scrolls to that section. (This is the fragment-URL idea from the links lesson, and it is how real single-page navigation works.)

Heading hierarchy inside semantics

Sections and articles have their own headings. Keep the levels consistent: the page has one <h1>; each <section> starts at <h2>; a sub-part uses <h3>. Screen-reader users navigate by headings like flipping through a book's chapters β€” skipped levels make that navigation feel like missing pages.

What you learned

  • Semantic elements name a region's role; <div> means "no role"
  • <header>, <nav>, <main> (exactly one), <section>, <article>, <aside>, <footer> β€” and what belongs in each
  • id + #fragment links power in-page navigation
  • Headings step down without skipping levels

Next: forms β€” how pages collect input.

⚑ Now practice

Ready to Code
Semantic HTML & Page Structure β€” PracticeHands-on practice for β€œSemantic HTML & Page Structure”: apply what you just learned in html-semantics.
2 challenges Β· Β· ~5 min