HTML chapters

Chapter 9 of 17

Semantic page sections

Try this in our HTML Compiler →

The idea

HTML does not declare or call functions. Reusable pages begin with clear semantic structure: header introduces a page, nav groups major navigation, main holds its primary content, and footer holds closing information. section groups a topic and should normally have a heading; article is independently meaningful content.

Worked example

<header><h1>Study journal</h1></header>
<main>
  <article><h2>First lesson</h2><p>I learned about elements.</p></article>
</main>
<footer><p>Written by a student.</p></footer>

What to check

The visible order also gives the document meaningful landmarks. Use one visible main region, not a main inside every article.

Practice task

Add a second article with its own heading. Put both inside the same main element.

Check your understanding

Explain the result in your own words before changing the example. Change one thing at a time, compare the result with your prediction, and keep the version that demonstrates the concept clearly.

Try it yourself

Output
Ctrl/Cmd+Enter runs · Ctrl/Cmd+S downloads the project · Local auto-save is always on