Free HTML tutorial

Semantic HTML: Use Meaningful Elements

Learn semantic HTML with header, nav, main, article, section and footer elements, and understand why meaningful page structure matters.

What semantic HTML means

Semantic elements describe the purpose of their content. They help browsers, assistive technology and developers understand how a page is organized.

Use page landmarks

Elements such as <header>, <nav>, <main> and <footer> identify major regions. A page generally has one main content area.

<header>
  <a href="/">Site name</a>
</header>
<nav aria-label="Main navigation">
  <a href="/about/">About</a>
</nav>
<main>
  <article>
    <h1>Page title</h1>
    <p>The main content goes here.</p>
  </article>
</main>
<footer>Copyright information</footer>

Choose elements for their meaning

Use <article> for content that can stand on its own, and <section> for a grouped topic with a heading. Use a <div> when no semantic element fits.

Keep headings in a useful order

Start the page with a clear <h1>, then use <h2> for main sections and <h3> for subsections. Choose heading levels by content structure, not by their visual size.

Choose between article, section and div

Use <article> for a piece that can stand on its own, such as a tutorial card or blog post. Use <section> to group related content under a heading. If you only need a wrapper for CSS or scripting and the group has no special meaning, use <div>.

<article>
  <h2>Getting started</h2>
  <section>
    <h3>Choose an editor</h3>
    <p>Start with a text editor you already have.</p>
  </section>
</article>

Quick semantic HTML checklist

  • Use one primary <main> area for the page's unique content.
  • Give each <nav> a label when a page has more than one navigation region.
  • Use headings to name sections, and choose elements for their purpose instead of their default appearance.

Semantic elements provide useful structure, but they do not replace clear link text, form labels, keyboard support or appropriate image alternatives. Read MDN's guide to structuring an HTML document for more examples.

Semantic markup gives content structure; CSS controls its appearance. A semantic element does not automatically make a page accessible, so labels, keyboard behavior and clear content still matter.