📚 Chapter 7: Semantic Tags in HTML

What are Semantic Tags?

Semantic tags clearly describe their meaning to both the browser and the developer. Unlike generic tags like <div> or <span>, semantic tags tell what kind of content they contain, which helps with SEO, accessibility, and maintainable code.

Using semantic tags improves:

Common Semantic Tags and Their Usage

1. <header>

The <header> element represents introductory content or a set of navigational links. It usually contains the site logo, main heading, or menu.

2. <nav>

The <nav> element defines a section intended for navigation links like menus or tables of contents.

3. <main>

The <main> tag holds the dominant content of the document. There should only be one <main> per page.

4. <section>

The <section> element groups related content into thematic sections, usually with a heading.

5. <article>

The <article> tag contains independent content that could be distributed or reused elsewhere, such as blog posts, news articles, or comments.

6. <aside>

The <aside> element holds content indirectly related to the main content — like sidebars, ads, or related links.

7. <footer>

The <footer> element contains footer content for its nearest sectioning content or the entire page. It typically includes author info, copyright, or contact info.

Practice Exercises

Try the following exercises to deepen your understanding of semantic tags:

By practicing, you will make your pages more structured, accessible, and easier to maintain.