Accessibility & SEO
Semantic HTML
Speak the language of search engines. Semantics give your content meaning and structure – far beyond design.
Imagine reading a newspaper, but all the headlines, texts, and images have the same font size and weight. You wouldn't know where an article starts and where an ad ends.
This is exactly what happens when you only use <div> ("div soup"). Semantic HTML (<header>, <article>) gives the code structure. Google loves it. Screen readers need it.
1. The Anatomy of a Website
Hover over the areas to understand how a modern page should be structured.
2. The Semantics Cheatsheet
Keep this list open while building your components. It is the guide for choosing the right tags.
<main>StructureThe unique main content. Should only appear once per view.
<header> & <footer>StructureNot just for the page! These define the top/bottom of *any* section.
<nav>StructureArea for major navigation blocks.
<article>ContentIndependent, self-contained content. Syndicatable.
<section>ContentA thematic grouping of content, usually with a heading.
<aside>StructureContent tangentially related to the content around it.
<h1> - <h6>TextThe outline of your document. Vital for screen readers.
<label>FormsThe most important tag for form accessibility.
<ul>, <ol>, <dl>ListsGrouping items. Screen readers announce "List, 5 items".
<figure> & <figcaption>MediaConnects media (images, code, video) with a description.
<details> & <summary>InteractiveA native HTML accordion/toggle without JavaScript.
<button> vs <a>InteractionThe semantic difference between "Go" and "Do".
3. Div Soup vs. Semantics
The code on the left works visually but is unreadable for machines. The right side is the clean solution.
Bad (Div Soup)
<div class="header">
<div class="nav">Menu</div>
</div>
<div class="main-content">
<div class="article">
<div class="title">Hello World</div>
</div>
</div>Good (Semantic)
<header>
<nav>Menu</nav>
</header>
<main>
<article>
<h1>Hello World</h1>
</article>
</main>Semantics is also SEO: Google weighs text in a
tag much higher than text in a bold . Your rankings will thank you.
. Your rankings will thank you.