Lesson 11 of 36
HTML Tutorial

Semantic Layout Elements

Use header, nav, main, section, article, aside and footer to describe the regions of a page.

3 min readBeginnerWeb FundamentalsInline & Block Elements

Imagine a page built only from <div> elements. To a browser or a screen reader it is a pile of anonymous boxes. HTML5 introduced semantic layout elements that name the regions of a page, so software (and people) can understand and navigate it. Let's lay out the Brew and Byte home page.

The main landmarks#

ElementMeaning
<header>Introductory content for the page or a section: logo, title, tagline
<nav>A block of major navigation links
<main>The unique, central content of the page
<section>A themed group of content, normally with its own heading
<article>A self-contained piece that makes sense on its own, such as a blog post
<aside>Tangential content: a sidebar, a pull quote, related links
<footer>Closing content for the page or a section: copyright, contacts

Several of these are landmarks: assistive technology lists them so a user can jump straight to the navigation or the main content.

Putting it together#

html
<body>
  <header>
    <h1>Brew and Byte</h1>
    <nav aria-label="Main">
      <ul>
        <li><a href="index.html">Home</a></li>
        <li><a href="menu.html">Menu</a></li>
        <li><a href="contact.html">Contact</a></li>
      </ul>
    </nav>
  </header>

  <main>
    <section>
      <h2>Today's specials</h2>
      <article>
        <h3>Cardamom latte</h3>
        <p>Espresso, steamed milk and freshly crushed cardamom.</p>
      </article>
      <article>
        <h3>Pumpkin soup</h3>
        <p>Served with warm sourdough.</p>
      </article>
    </section>

    <aside>
      <h2>Did you know?</h2>
      <p>Every Friday evening we host an open mic night.</p>
    </aside>
  </main>

  <footer>
    <p>&copy; 2025 Brew and Byte, 12 Lakeside Road.</p>
  </footer>
</body>

Notice the pattern: the page has one <header>, one <main>, one <footer>, a <nav> for the menu, and sections and articles nested within the main content.

Choosing between section, article and div#

  • Ask "could this piece be shared or syndicated on its own?" If yes, use <article>. A product card, comment or news story qualifies.
  • Ask "is this a thematic group that deserves a heading?" If yes, use <section>.
  • If it is only a styling wrapper with no meaning, use <div>.

A <section> without a heading is usually a sign you want a <div>.

Rules worth remembering#

  • Use one visible <main> per page. Never nest it inside header, footer, nav, aside or article.
  • header and footer can appear inside article or section too, as local introductions and endings.
  • When you have more than one <nav>, label each with aria-label ("Main", "Footer") so users can tell them apart.
  • Keep the heading outline sensible inside each region.

Common mistakes#

  • Using <section> as a replacement for every div.
  • Using <header> only for the top banner. It is also valid inside articles.
  • Placing all site-wide navigation links in a plain div instead of nav.
  • Forgetting <main>, leaving screen reader users with no shortcut to the content.
  • Choosing elements for their default look. These have no special visual style.

Try it yourself#

Take a page you already wrote and restructure it with semantic elements. Include a header with a logo heading and a nav, a main with at least two sections, one article, one aside, and a footer with a copyright line. Open Developer Tools and check that the structure appears as you intended. If you have a screen reader available, list the landmarks.

Recap#

Semantic layout elements describe what each region is: header, nav, main, section, article, aside and footer. They give assistive technology and search engines landmarks to navigate. Fall back to div only when nothing else fits.

Check your understanding

Lesson quiz

Optional

A short quiz to check what you just learned.

Questions
4
Time limit
5 min
Pass mark
70%
Best score
-