HTML

Semantic HTML: Header, Nav, Main, Article, and Footer

Learn semantic HTML and how to use header, nav, main, section, article, aside, and footer to build better structured and SEO-friendly websites.

RazakTerra
Reading time
1 min read
Comments
Discussion
Semantic HTML: Header, Nav, Main, Article, and Footer
On this page
  1. Common Semantic Tags
  2. Simple Example
  3. Quick Tips

Semantic HTML means using tags that describe the meaning of the content, not just how it looks. Instead of wrapping everything in <div>, you can use more meaningful tags that help browsers, search engines, and screen readers understand your page better.

Common Semantic Tags

<header> for introductory content or navigation

HTML
<header>
  <h1>My Website</h1>
  <p>Welcome to my personal site</p>
</header>

<nav> for main navigation links

HTML
<nav>
  <a href="/">Home</a>
  <a href="/about">About</a>
  <a href="/contact">Contact</a>
</nav>

<main> the main content of the page (should only be used once)

HTML
<main>
  <h2>About Me</h2>
  <p>This is the main content of the page.</p>
</main>

<article> for self-contained content like blog posts or news

HTML
<article>
  <h2>My First Blog Post</h2>
  <p>This is a complete article that can stand on its own.</p>
</article>

<section> for grouping related content

HTML
<section>
  <h2>Skills</h2>
  <p>HTML, CSS, and JavaScript</p>
</section>

<aside> for side content like sidebars or tips

HTML
<aside>
  <p>Related tip: Learn semantic HTML early!</p>
</aside>

<footer> — for footer information

HTML
<footer>
  <p>© 2026 My Website</p>
</footer>

Simple Example

HTML
<body>
  <header>
    <h1>Alex's Blog</h1>
    <nav>
      <a href="/">Home</a>
      <a href="/about">About</a>
    </nav>
  </header>

  <main>
    <article>
      <h2>Learning HTML</h2>
      <p>Semantic tags make your code clearer.</p>
    </article>
  </main>

  <footer>
    <p>© 2026 Alex</p>
  </footer>
</body>

Quick Tips

  • Use semantic tags when they match the meaning of the content.
  • Don’t use them just for styling, that’s what CSS is for.
  • One <main> per page is the best practice.
  • Semantic HTML improves both SEO and accessibility.

Written by

Razak

Writes about the web, slowly, and builds small tools on the side.

Discussion

Comments

Loading comments…

Keep reading