Lesson 6: Sematic HTML

HYPERLINK CODE ACADEMY • HTML COURSE

Lesson 06: Semantic HTML

Learn how to organize your webpage using meaningful HTML elements.

01 — What Is Semantic HTML?

So far, you've learned how to create headings, paragraphs, images, links, lists, tables, and forms.

But how do you organize all those elements into a proper webpage?

That's where semantic HTML comes in!

Semantic HTML means using HTML elements that describe the purpose of the content they contain.

For example:

<header>
  <h1>My Website</h1>
</header>

<main>
  <p>Welcome to my website!</p>
</main>

<footer>
  <p>Copyright 2026</p>
</footer>

Even without seeing the page, you can understand which part is the header, main content, and footer.

02 — The Header Element

The <header> element represents introductory content for a webpage or a section.

It often contains:

  • A website logo or name
  • A heading
  • Introductory text
  • Navigation elements
<header>
  <h1>HYPERLINK</h1>
  <p>Your world. Your community.</p>
</header>
Remember: A header can be used for an entire page or for an individual section or article.

03 — The Navigation Element

The <nav> element contains important navigation links that help visitors move around a website.

<nav>
  <a href="/">Home</a>
  <a href="/discover/">Discover</a>
  <a href="/following/">Following</a>
  <a href="/about/">About</a>
</nav>

These links could be displayed in a navigation bar at the top of your website.

Tip: Not every single link needs to be inside a <nav>. It is mainly for important groups of navigation links.

04 — The Main Element

The <main> element contains the primary content of a webpage.

For example, on a newspaper website, the main content might be an article. On a community website, it could be a feed of posts.

<main>
  <h1>Welcome to HYPERLINK</h1>

  <p>
    Discover communities, read articles,
    and share your ideas.
  </p>
</main>

A webpage should generally have one visible <main> element representing its primary content.

05 — Section and Article Elements

The section element

The <section> element groups related content together. It usually has its own heading.

<section>
  <h2>Latest News</h2>
  <p>Read the newest articles here.</p>
</section>

The article element

The <article> element represents content that can stand on its own, such as a newspaper article, blog post, or news story.

<article>
  <h2>The Future of Technology</h2>
  <p>Technology continues to change our world...</p>
</article>
What's the difference? A section groups related content. An article represents a self-contained piece of content.

06 — The Aside and Footer Elements

The aside element

The <aside> element contains related or supplementary information that is separate from the main content.

<aside>
  <h3>Related Articles</h3>
  <a href="/technology/">Technology News</a>
</aside>

The footer element

The <footer> element contains closing information for a webpage or section.

It might include:

  • Copyright information
  • Contact information
  • Privacy policy links
  • Additional navigation links
<footer>
  <p>Copyright 2026 HYPERLINK</p>
  <a href="/privacy/">Privacy Policy</a>
</footer>

07 — Putting Everything Together

Now let's combine the semantic elements into one webpage.

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>My Website</title>
</head>

<body>

  <header>
    <h1>My Website</h1>
  </header>

  <nav>
    <a href="/">Home</a>
    <a href="/about/">About</a>
  </nav>

  <main>

    <section>
      <h2>Welcome!</h2>
      <p>Thanks for visiting my website.</p>
    </section>

    <article>
      <h2>My First Article</h2>
      <p>This is my first article.</p>
    </article>

    <aside>
      <p>Check out my other pages!</p>
    </aside>

  </main>

  <footer>
    <p>Copyright 2026</p>
  </footer>

</body>
</html>

Visualize the structure

HEADER
Website name and introduction
NAV
Navigation links
MAIN
SECTION
Related content
ARTICLE
Standalone content
ASIDE
Supplementary information
FOOTER
Copyright and extra links

This is one way to organize a webpage. You can arrange sections and articles differently depending on what your website needs.

08 — Why Does Semantic HTML Matter?

Semantic HTML isn't just about making your code look organized. It has several important benefits.

  • Accessibility: Screen readers can better understand the structure of your page.
  • Organization: Developers can understand your code more easily.
  • SEO: Search engines can better interpret the meaning and structure of your content.
  • Maintenance: Organized code is easier to update and improve.
Important: Semantic HTML does not automatically make a website look beautiful. CSS controls the appearance, while HTML provides the structure and meaning.

09 — Try It Yourself!

Your challenge is to create a small website using semantic HTML.

Your page must include:

  1. A <header> with your website name.
  2. A <nav> with at least three links.
  3. A <main> containing your primary content.
  4. A <section> with a heading and paragraph.
  5. An <article> with a title and description.
  6. An <aside> with related information.
  7. A <footer> with copyright information.

You can use HYPERLINK as inspiration, or invent a completely new website!

10 — Quick Knowledge Check

Question 1: Which element contains the primary content of a webpage?


Question 2: Which element is used for important navigation links?


Question 3: Which element is best for a self-contained newspaper article?


Question 4: Which language controls the appearance and styling of a webpage?

⚙