For a long time, web developers used the <div> and <span> tags for absolutely everything. A typical webpage structure consisted of dozens of nested divs with classes like class="header", class="footer", and class="sidebar".
This was problematic because a div has no inherent meaning. Search engine bots (like Google) and screen readers for visually impaired users couldn't easily tell which part of the page was the main content, which part was a menu, and which part was just a footer link.
HTML5 introduced Semantic Elements to fix this: tags that clearly describe their meaning to both the browser and the developer.
Switching from generic divs to descriptive semantic tags provides three massive benefits:
<nav> menu or jump directly into the <main> content area.<article> over text stuck down in a <footer>, leading to better search rankings.<div> tags.| Element | Semantic Meaning / Usage |
|---|---|
<header> |
The introductory content of a page or section (usually contains logos and main headings). |
<nav> |
Container strictly devoted to a block of major navigation links. |
<main> |
The uniquely dominant content of the document. There should only be one per page! |
<article> |
A self-contained composition that would make sense if it was removed and syndicated elsewhere (like a blog post, news story, or forum post). |
<section> |
A thematic grouping of content, usually containing its own heading (like "Contact Us" or "Product Features"). |
<aside> |
Content tangentially related to the main article, but often placed as a sidebar (like related links, ad banners, or author bios). |
<footer> |
The bottom section of a document or article containing copyright data, legal links, or author info. |
Here is what a modern, perfectly semantic wireframe looks like in HTML5:
<body>
<header>
<h1>Daily Tech News</h1>
<nav>
<a href="/">Home</a> | <a href="/about">About</a>
</nav>
</header>
<main>
<article>
<h2>New AI Model Released</h2>
<p>Today, researchers announced...</p>
</article>
<aside>
<h3>Trending Articles</h3>
<ul>
<li><a href="#">Quantum Computing Explained</a></li>
</ul>
</aside>
</main>
<footer>
<p>© 2024 Tech News Inc. All rights reserved.</p>
</footer>
</body>
<section>, <main>, <article>, etc.) behave visually exactly like a standard <div>. They do not have special built-in margins or magical layouts—they are purely for semantic meaning!