Skip to content
FORGENO ADS GAMESUnlock all $8

HTML · Unit 2: Images and page structure · Lesson 3 of 5

Page sections

Semantic elements say what a part of the page is for.

Opens this lesson in Code Academy. Lessons open one after another, and each unit opens when you pass the checkpoint quiz before it (you can take a checkpoint early to skip ahead). If this lesson is not open yet, the button shows you its unit on your map.

The idea

Semantic elements say what a part of the page is for. <header> is the top of the page, <nav> holds the main links, <main> holds the main content and <footer> is the bottom.

They look like plain boxes, but browsers, search engines and screen readers use them to understand the page and to jump around it.

Use one <main> per page. <section> groups content that has its own heading. <div> is a box with no meaning, for when nothing else fits.

Worked example

HTML

<header>
  <h1>River Café</h1>
  <nav>
    <a href="https://example.com/menu">Menu</a>
    <a href="https://example.com/visit">Visit us</a>
  </nav>
</header>
<main>
  <p>Fresh bread every morning.</p>
</main>
<footer>
  <p>Open daily, 7am to 3pm</p>
</footer>

Key terms

Semantic HTML
Elements that say what content is for, like <header>, <nav>, <main>, <article> and <footer>.

Practise it in Code Academy

It has 4 exercises (multiple choice, fix the broken code and write code from a prompt) and takes about 7 minutes. Every answer is checked as you go, and feedback names the exact mistake. Hints and the solution are there if you get stuck.

Every lesson is free: no ads, no lives and no paywall.