Skip to content

Semantic HTML Tags | Lecture 16

Semantic HTML Tags

Let’s begin with Lecture 16 of the HTML5 & CSS3 series. Semantic HTML Tags – Building Meaningful Web Pages. This lecture is for absolute beginners; even kids can follow along and understand.

🎯 Objective:

By the end of this lecture, you will:

  • Understand what semantic HTML is and why it’s important
  • Know how to use semantic tags like <header>, <footer>, <nav>, <main>, <section>, and <article>
  • Be able to structure your webpage in a clear and meaningful way
  • Improve accessibility and SEO by using the right tags for the right job

🧠 What Is Semantic HTML?

Semantic HTML means using the right tag for the right purpose, so both browsers and people understand what each part of your page is for.

Think of it like this:

If your website is like a book, then semantic tags are like chapter titles and section headings — they help readers (and computers) understand the story better!

🔤 Why Use Semantic Tags?

BenefitExplanation
Better AccessibilityScreen readers can read pages more clearly
Improved SEOSearch engines understand your content better
Easier to ReadOther developers can understand your code faster
Future-ProofSemantic markup works well with new tools and devices

📦 Common Semantic Tags

TagPurpose
<header>Usually contains the site title or navigation
<nav>Navigation links (like menus)
<main>Main content of the page
<section>A thematically grouped block of content
<article>Independent piece of content (like a blog post)
<aside>Sidebar content or related links
<footer>Footer content (copyright, contact info, etc.)
💻 Try This: Make Your Page More Semantic

Let’s update your homepage (index.html) to use semantic tags instead of only <div>s or generic containers.

Step 1: Open index.html

Make sure your HTML looks something like this:

<!DOCTYPE html>
<html>
<head>
    <title>Welcome</title>
    <style>
        body {
            background-color: hsl(210, 30%, 95%);
            font-family: 'Georgia', serif;
            padding: 30px;
            line-height: 1.6;
        }

        h1 {
            font-family: 'Comic Sans MS', cursive, sans-serif;
            color: hsl(350, 100%, 40%);
            font-size: 36px;
            text-align: center;
            border-bottom: 3px solid hsl(200, 80%, 50%);
            padding-bottom: 10px;
        }

        h2 {
            font-family: 'Trebuchet MS', sans-serif;
            color: rgb(255, 87, 34);
            font-size: 24px;
            font-weight: bold;
            font-style: italic;
        }

        p {
            font-size: 18px;
            color: #2e2e2e;
            text-align: justify;
        }

        .highlight {
            background-color: hsla(60, 100%, 75%, 0.5);
            padding: 5px;
            font-weight: bold;
            text-decoration: underline;
        }
    </style>
</head>
<body>
    <h1>Welcome to My Website</h1>
    <p>Hello! In this article, I'm going to share some fun facts about animals.</p>

    <h2>Cats</h2>
    <p>Cats are amazing pets...</p>

    <h2>Dogs</h2>
    <p>Dogs are loyal friends...</p>

    <h2>Birds</h2>
    <p class="highlight">Birds can fly and sing beautiful songs. Some birds even talk!</p>
</body>
</html>
Step 2: Update with Semantic Structure

Replace the <body> Content with this updated version:

<body>
    <header>
        <h1>Welcome to My Website</h1>
        <nav>
            <a href="index.html">Home</a> |
            <a href="contact-form.html">Contact</a> |
            <a href="my-favorites.html">My Favorites</a>
        </nav>
    </header>

    <main>
        <section>
            <h2>About This Article</h2>
            <p>Hello! In this article, I'm going to share some fun facts about animals.</p>
        </section>

        <section>
            <article>
                <h2>Cats</h2>
                <p>Cats are amazing pets...</p>
            </article>

            <article>
                <h2>Dogs</h2>
                <p>Dogs are loyal friends...</p>
            </article>

            <article>
                <h2>Birds</h2>
                <p class="highlight">Birds can fly and sing beautiful songs. Some birds even talk!</p>
            </article>
        </section>
    </main>

    <aside>
        <h3>Did You Know?</h3>
        <p>Penguins can’t fly, but they are great swimmers!</p>
    </aside>

    <footer>
        <p>&copy; 2025 MyWebsite. All rights reserved.</p>
    </footer>
</body>
Step 3: Run with Live Server

Right-click the code → Show All Commands → Launch Live Server

🎉 You’ve made your page more structured, accessible, and meaningful using semantic HTML!

Semantic HTML Tags
A kid typing into a computer screen looking at a beautiful website

🧪 Try It Yourself!

  1. Add another <section> for “Top 5 Animal Facts”.
  2. Wrap one of the links inside <nav> with a <button> style as a menu item.
  3. Give them <footer> a background color using CSS.
  4. Style it <aside> to look like a sidebar with a border.
🚀 Next Lecture Preview:

In Lecture 17, we’ll learn how to work with the Box Model, including margin, padding, and border — so you can control spacing and layout like a pro!

Stay Updated

If you found this information useful, don’t forget to bookmark this page and Share and leave your feedback in the comment section below.

HTML5 and CSS3 Compleate Series

Najeeb Alam

Najeeb Alam

Technical writer specializes in developer, Blogging and Online Journalism. I have been working in this field for the last 20 years.