Aral Code

Page Structure Lesson 26 of 42

HTML Semantic Elements — header, nav, main, section, article, footer

Learn semantic HTML elements like header, nav, main, section, article, aside and footer, and why meaningful structure helps SEO and accessibility.

"Semantic" means "related to meaning." A semantic element tells the browser and the reader what its content is, not just how it looks. <p> is semantic (it's a paragraph). <div> is not (it could be anything). Modern HTML has a set of semantic elements for the big parts of a page — the header, the menu, the main content, the footer — and using them is one of the marks of a skilled web developer.

The main semantic layout elements

ElementUse it for
<header>The top part of a page or a section: logo, site name, title
<nav>A block of main navigation links (a menu)
<main>The main content of the page — only one per page
<section>A themed group of content, usually with its own heading
<article>A complete, independent piece: a blog post, news story, product card
<aside>Side content related to the page: tips, related links, ads
<footer>The bottom of a page or section: copyright, contact, links

A page built with semantic elements

Example A barangay news page
<header>
  <h1>Barangay Malinis News</h1>
  <nav>
    <a href="#">Home</a> |
    <a href="#">Announcements</a> |
    <a href="#">Officials</a> |
    <a href="#">Contact</a>
  </nav>
</header>

<main>
  <article>
    <h2>Clean-Up Drive This Saturday</h2>
    <p>All residents are invited to join the coastal clean-up on Saturday, 6:00 AM, at the barangay plaza. Gloves and sacks will be provided.</p>
  </article>

  <article>
    <h2>Free Vaccination at the Health Center</h2>
    <p>The barangay health center offers free flu vaccines for senior citizens every Tuesday this month.</p>
  </article>

  <aside>
    <h3>Emergency Hotlines</h3>
    <p>Barangay Hall: 0917 000 0000<br>Fire: 160<br>National Emergency: 911</p>
  </aside>
</main>

<footer>
  <p>&copy; 2026 Barangay Malinis. Purok 1–7, Sample City.</p>
</footer>

Read the code without the content. You can understand the layout of the page just from the element names. That's semantic HTML.

Before semantic elements

Older websites did the same thing with divs and class names:

<div class="header">...</div>
<div class="nav">...</div>
<div class="main">...</div>
<div class="footer">...</div>

It worked visually, but a <div class="nav"> means nothing to a browser. <nav> does. Same look, much more meaning.

Why it matters

1. Accessibility

Screen readers let users jump straight to the <main> content, skip the menu, or list all the <nav> regions. For a blind visitor, this is like an elevator compared to taking the stairs on every page.

2. Search engines

Google can tell which part is your real content (<main>, <article>) and which part is repeated on every page (<header>, <nav>, <footer>). This helps it understand and rank your page.

3. Cleaner code

Your code is easier for you and your groupmates to read. </article> tells you exactly what's closing; </div> could be any of fifty divs.

section vs. article vs. div

These three confuse everyone at first. Ask yourself:

  1. Would this make sense on its own, if you copied it to another website or shared it on Facebook? → <article> (a news post, a recipe, a product, a comment).
  2. Is it a part of the page about one theme, with its own heading? → <section> (an "About Us" part, a "Services" part, a chapter).
  3. Is it just for styling or layout, with no meaning? → <div>.
Example Sections inside a school homepage
<main>
  <section>
    <h2>About Our School</h2>
    <p>Founded in 1965, we serve over 2,000 junior and senior high school students.</p>
  </section>
  <section>
    <h2>Academic Tracks</h2>
    <ul>
      <li>Academic Track – STEM, ABM, HUMSS</li>
      <li>TVL Track – ICT, Home Economics</li>
    </ul>
  </section>
</main>

<header> and <footer> aren't only for the whole page. An <article> can have its own header (title, author, date) and its own footer (tags, share buttons):

<article>
  <header>
    <h2>Our Trip to Taal Volcano</h2>
    <p>By Grade 9 – Luna · March 3, 2026</p>
  </header>
  <p>We left the school at 5 AM...</p>
  <footer>
    <p>Tags: field trip, Batangas, science</p>
  </footer>
</article>

Other semantic elements you know

You've already used many semantic elements: <h1>–<h6>, <p>, <strong>, <em>, <blockquote>, <figure>, <figcaption>, <table>, <address>. Two more worth knowing: <time> for dates (<time datetime="2026-06-12">June 12</time>) and <mark> for highlights.

Quick Quiz

Check what you learned. Walang grade ito, practice lang. 🙂

1. Which element should hold the main menu of a website?
2. How many <main> elements should a page have?
3. A news story that could be shared on its own best fits which element?
4. Why are semantic elements better than divs with class names like "header"?

By Sir Reyel · Last updated 2026-12-04