Menu
Coddy logo textTech

Semantic Tags

Part of the Fundamentals section of Coddy's HTML journey — lesson 27 of 60.

Semantic tags in HTML help define the meaning of content, making the code clearer for both developers and browsers. Unlike <div> and <span>, they give context to the enclosed content.

Common Semantic Tags:

  • <header> – Introductory content, usually at the top.
  • <nav> – Contains navigation links.
  • <main> – Main content of the page.
  • <article> – A self-contained piece like a blog post.
  • <section> – Groups related content, often with a heading.
  • <footer> – Bottom section with info like copyright or contact details.
<header>
	<nav>
		<ul>
			<li><a href="#">Home</a></li>
			<li><a href="#">About</a></li>
			<li><a href="#">Contact</a></li>
		</ul>
	</nav>
</header>
<main>
	<article>
		<h2>Article Title</h2>
		<p>Article content goes here.</p>
	</article>
</main>
<footer>
	<p>Copyright 2023</p>
</footer>

This structure provides a clear and meaningful layout for the content.

challenge icon

Challenge

Easy

Build a movie review page using semantic HTML. It should include:

1. <header> with:

  • <h1> "Movie Reviews"
  • <nav> with links: "Home", "Reviews", “Top Picks”

2. <main> with:

  • <article> for a review that contains:
    • <h2> with the movie name
    • <p> with a short review

3. <footer> with:

  • <p> "Copyright 2023 Movie Reviews"

Cheat sheet

Semantic tags in HTML help define the meaning of content, making the code clearer for both developers and browsers. Unlike <div> and <span>, they give context to the enclosed content.

Common Semantic Tags:

  • <header> – Introductory content, usually at the top.
  • <nav> – Contains navigation links.
  • <main> – Main content of the page.
  • <article> – A self-contained piece like a blog post.
  • <section> – Groups related content, often with a heading.
  • <footer> – Bottom section with info like copyright or contact details.
<header>
	<nav>
		<ul>
			<li><a href="#">Home</a></li>
			<li><a href="#">About</a></li>
			<li><a href="#">Contact</a></li>
		</ul>
	</nav>
</header>
<main>
	<article>
		<h2>Article Title</h2>
		<p>Article content goes here.</p>
	</article>
</main>
<footer>
	<p>Copyright 2023</p>
</footer>

Try it yourself

<!DOCTYPE html>
<html>
    <body>
        <!-- Write code here -->
    </body>
</html>
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Fundamentals