Semantic HTML uses descriptive tag names—such as article, nav, main, and button—that explain the role of their content rather than relying solely on generic div and span containers. Both search engine crawlers and screen readers depend on semantic tags to understand page structure accurately.
Replace repetitive generic wrappers with landmarks and content tags that match the content's purpose:
header and nav: Identify site branding and primary navigation links.main: Marks the central unique content of the document so keyboard users can skip repeated menus.article: Wraps standalone, reusable pieces like blog posts, forum threads, or product cards.section: Groups thematic chapters inside a page, paired with a heading (h2 or h3).aside: Holds supporting sidebars, author notes, or callout boxes.figure, figcaption, and time: Pair media with captions and machine-readable ISO dates (datetime="2026-11-12").<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Semantic HTML5 Article</title>
</head>
<body>
<header>
<nav aria-label="Main Menu"><a href="/blog">Engineering Blog</a></nav>
</header>
<main>
<article>
<header>
<h1>Why Semantic HTML Matters</h1>
<p>Published <time datetime="2026-11-12">November 12, 2026</time></p>
</header>
<section>
<h2>Screen Reader Navigation</h2>
<p>Assistive tools list landmarks and headings so visitors jump straight to answers.</p>
</section>
<footer><p>Tags: HTML5, Accessibility</p></footer>
</article>
</main>
<footer><p>© 2026 KoderSolution</p></footer>
</body>
</html>
div onclick="..." instead of button: Fake clickable div tags miss keyboard Enter/Space activation and focusability automatically provided by button.section when div is meant: Reserve section for meaningful thematic regions that usually carry a heading.role="navigation" to a nav tag is unnecessary because nav already carries that implicit role.Yes. Clear landmark and heading tags help crawlers identify primary article copy versus boilerplate sidebars and footers.
Use div and span purely as styling or layout hooks (such as Flex/Grid wrapper containers) when no semantic tag describes the group.
Sign in to track your learning journey, earn industry-recognized certificates, and join our elite developer community.
Quick Access With
Experiment with the code from this lesson in our interactive playground.