CHAPTER 39 · HTML

Semantic page structure: give each area a clear purpose

Learn header, nav, main, section, article, aside and footer. Choose by meaning and keep a page understandable without decorative layout.

Download example files (ZIP)

Semantic means about meaning

A college building labels places Library, Office and Laboratory. Those names tell you more than Room. Semantic HTML uses elements whose names describe the job of the content. Nav identifies navigation; main identifies the dominant page content. Div only says there is a generic group.

Clear structure helps people and tools understand a page. It can support accessibility and search understanding, but does not guarantee a search ranking or fix every accessibility problem.

A quick map of the elements

  • Header: introductory content for a page or suitable section.
  • Nav: a significant navigation group.
  • Main: the dominant content of this document.
  • Section: a related topic group, usually with a heading.
  • Article: a self-contained item that makes sense independently.
  • Aside: supplementary material related to the surrounding discussion.
  • Footer: closing or related information for a page or suitable section.

These elements do not automatically make a horizontal menu, fixed header or right-hand sidebar. CSS controls those arrangements.

Header is not head

Head contains document information such as title and metadata. Header is visible body content, such as a club introduction or an article heading. A page header and an article header can both exist. They serve different contexts. Do not put a header inside another header or footer.

Use one clear page h1 in these lessons, h2 for major groups and h3 for a subgroup. Section does not automatically correct heading levels. Choose levels explicitly rather than choosing a heading for its font size.

Nav and main help readers find their place

Use nav for important navigation groups, not every single link. More than one nav can exist. Give different accessible names when they have different jobs, such as Page sections and Main navigation. Aria-label supplies a name when there is no suitable visible heading to reference.

Use one visible main for these normal single-page documents. Keep repeated site navigation and the site footer outside it. Do not nest main inside article, aside, header, footer or nav. A link to main can provide a skip route for keyboard users.

Section and article answer different questions

Ask: do these paragraphs form a named topic within a larger page? Section may fit. Then ask: could this item make sense as a complete item elsewhere? Article may fit. A workshop announcement with its own heading and date is a good article example.

An article can contain sections. A section can group several articles. They are not competing levels in a fixed hierarchy. Avoid section merely to make a padded box; use div for a presentation-only wrapper. A section usually deserves a heading explaining its topic.

Aside and footer describe a relationship

Aside may hold a related reminder or supplementary links. It need not sit at the right side. If text is essential to understanding the task, keep it in the main discussion rather than calling it an aside.

Footer can identify authorship or related information. An article footer belongs to that article; a body-level footer belongs to the page. Multiple footers can therefore be appropriate. Footer does not force content to the bottom of the screen.

Structure still needs clear content

Semantic regions do not replace descriptive headings, link wording, image alternatives or form labels. Native elements already convey useful meaning; role=main on main is unnecessary. Not every section automatically becomes a named landmark for assistive technology. Provide suitable names where needed and test the actual page.

Read the source and visible page in order. Can someone identify the main task without guessing which box or colour matters? If not, revise the content and structure before adding decoration.

Follow the idea

Read the page by purpose
  1. 1Header and nav: introduction and routes
  2. 2Main and section: the central topics
  3. 3Article: a complete independent item
  4. 4Aside and footer: related or closing information

These names describe purpose, not automatic screen positions.

Complete program: page-regions.html

Save this as page-regions.html. Open it in your browser.

page-regions.html
<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>A Page with Clear Regions</title>
  </head>
  <body>
    <h1>A study club page</h1>
    <header><p>Practice Club</p></header>
    <nav aria-label="Page sections">
      <a href="#meeting">Meeting</a> | <a href="#bring">What to bring</a>
    </nav>
    <main>
      <section id="meeting">
        <h2>Next meeting</h2>
        <p>We will practise writing clear links.</p>
      </section>
      <section id="bring">
        <h2>What to bring</h2>
        <ul>
          <li>A notebook</li>
          <li>One question</li>
        </ul>
      </section>
    </main>
    <footer><p>This is a fictional practice page.</p></footer>
  </body>
</html>
Browser previewDocument title: A Page with Clear Regions

This preview shows the example in a browser. Save the complete code in local files to test links between pages and downloads. Same-page section links work here.

Expected result: a main heading, club information, section links, two topic groups and closing information. Links target real ids. Regions follow ordinary document order, not automatic columns.

Complete program: article-notice.html

Save this as article-notice.html. Open it in your browser.

article-notice.html
<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>An Independent Club Notice</title>
  </head>
  <body>
    <h1>Practice club notices</h1>
    <main>
      <article>
        <header>
          <h2>Room change for the link workshop</h2>
          <p>Posted <time datetime="2027-02-08">8 February 2027</time></p>
        </header>
        <p>The fictional link workshop will meet in Room B-204 instead of B-201.</p>
        <section>
          <h3>What stays the same</h3>
          <p>The practice topic and starting time are unchanged.</p>
        </section>
        <footer><p>Prepared by the practice desk.</p></footer>
      </article>
      <aside>
        <h2>Related reminder</h2>
        <p>Keep your original notes for comparison.</p>
      </aside>
    </main>
  </body>
</html>
Browser previewDocument title: An Independent Club Notice

This preview shows the example in a browser. Save the complete code in local files to test links between pages and downloads. Same-page section links work here.

Expected result: a self-contained room-change notice with a dated introduction, subgroup and closing credit, then a supplementary reminder. The notice remains meaningful outside this page.

Problem and solution

Problem: the author calls the workshop date aside because it should appear in a right column.

Solution: keep the essential date with workshop information. Use CSS later to place it. Choose aside for supplementary content, not a desired position.

Common mistakes and useful tips

  • Do not confuse head and header.
  • Do not put main inside navigation.
  • Not every wrapper needs section.
  • Article is not limited to newspaper stories.
  • Semantic tags do not create a visual grid.
  • Use explicit heading levels.

Practice questions

  1. What does semantic mean here?
  2. Which area holds dominant page content?
  3. Can an article contain a section?
  4. Must aside appear on the right?
  5. How do head and header differ?
  6. Remove styling from a semantic page. What should remain clear?
Check your practice answers
  1. The element describes the purpose of its content.
  2. Main; use one visible main in these ordinary documents.
  3. Yes. A complete item can have topic groups.
  4. No. It describes supplementary content, not position.
  5. Head stores document information. Header introduces visible content.
  6. Reading order, headings, navigation and relationships between main and supplementary content.

Interview questions

When choose article instead of div?

For a self-contained item such as an independently understandable announcement. Div is a generic group without that specific meaning.

Can a page have several headers or footers?

Yes, in different contexts such as the page and an article. They must still obey nesting rules.

Does section reset heading levels?

No. Choose explicit levels matching the hierarchy rather than relying on an automatic outline.

Why use native semantic elements?

They express purpose to readers and tools, alongside correct headings, names, labels and other accessibility work.

Quick revision

  • Choose regions by purpose.
  • Head and header differ.
  • Use headings to describe topics.
  • HTML expresses structure; CSS controls placement.