Section, article, and nav communicate purpose; div merely groups content. Choose the element that best explains the relationship between its children.
What You Need to Know
You do not need a semantic element for every wrapper. CSS can style a div without changing the document outline.
The goal is not to collect as many tags as possible. Pick the element that best describes what the content really is.
Example: See It in Action
This example keeps the idea small. Copy it carefully, then follow the explanation instead of guessing what the browser will do.
This is a short HTML fragment. To try it as a webpage, put it inside the body element of a complete HTML document.
<section>
<h2>Music lessons</h2>
<p>Weekly sessions.</p>
</section>
<div class="card">
<p>Same layout wrapper, no extra meaning.</p>
</div>
<p>Choose section only for a real section of a document.</p>
Let’s Understand the Example
- Section groups content around a shared topic and usually has a heading.
- An h2 starts a major section beneath the page topic.
- A p groups a paragraph of related text. Start another paragraph for a new thought.
- Class is a reusable label for styling or scripts; several elements may share the same class.
You should see a readable heading and its related content. The heading level tells readers how the ideas fit together, not merely how large the letters look.
What Should You See?
The page should display “Music lessons” as a heading, followed by its related content. Change the heading text and refresh the browser to see the result.
Read only the headings, from top to bottom. Do they tell a sensible story? If not, move sections or choose levels that match the content.
Try It Yourself
- Decide whether a product card is a self-contained article or only a div wrapper.
- Save your changes, open or refresh the page, and compare the result with the original example.
- Tell a friend what your change did. If you are not sure, undo it, refresh the page, and compare.
Common Beginner Mistakes
- Using section for a single decoration-only background box.
- Avoid picking tags just for their default bold, italic or spaced appearance. Use CSS for presentation.
Key Takeaways
- Section, article, and nav communicate purpose; div merely groups content.
- Section groups content around a shared topic and usually has a heading.
- You do not need a semantic element for every wrapper. CSS can style a div without changing the document outline.