What is semantic HTML?
Covered here
- Semantic vs non-semantic elements
- Who benefits from semantic HTML
- When div and span are still right
- Choosing the most meaningful element
Short answer
Semantic HTML means choosing tags that describe what content is, not just how it looks. A <button> is a button. A <nav> is navigation. A <div> means nothing at all. Meaningful tags help screen readers, search engines, browser features like reader mode, and the next person who edits your code.
Semantic vs generic
<!-- Non-semantic -->
<div class="button" onclick="order()">Order now</div>
<!-- Semantic -->
<button type="button" onclick="order()">Order now</button>
Both look the same with CSS. But the real button can be reached with the Tab key, pressed with Enter or Space, and is announced as button by screen readers. The div does none of that unless you rebuild it all by hand.
Who benefits
- Screen reader users navigate by landmarks, headings, lists, and buttons.
- Keyboard users get focus and activation for free on links, buttons, and form fields.
- Search engines get clearer signals about the main content and structure.
- Reader mode and translation tools find the article body more reliably.
- Developers read the code faster.
When div and span are right
<div> (a block) and <span> (inline) are generic containers for styling. Use them when no other element fits, like a wrapper for a CSS grid. They are not bad. They are just a last choice.
Pick the most meaningful element
| Content | Use | Not |
|---|---|---|
| Clickable action | <button> | <div onclick> |
| Goes to another page | <a href> | <button> |
| Section title | <h2> | <div class=“title”> |
| List of items | <ul> | Many <div>s |
| Date | <time datetime> | <span> |
A simple rule: links go somewhere, buttons do something.
Try it: swap divs for meaning
Replace each div with the most meaningful element: a heading, a list, a link, and a button.
Live preview
Quick quiz
Common mistakes
- Div soup. Pages built only from divs are hard to navigate.
- Buttons as links or links as buttons. Each has different keyboard and screen reader behavior.
- Picking tags by default style. Style comes from CSS, meaning from tags.
Your action
Tick each item when you can do it. Your progress saves on this device.
Key terms
- Semantic HTML
- Using tags that describe content meaning.
- <div>
- A generic block container with no meaning.
- <span>
- A generic inline container with no meaning.
- Landmark
- A major page region screen readers can jump to.
- <time>
- Marks a date or time in a machine-readable way.
Questions beginners ask
Does semantic HTML help SEO?
It gives search engines clearer structure. Content quality still matters most.
Is semantic HTML the same as accessibility?
It is the foundation of accessibility, but not all of it.
What is ARIA?
ARIA attributes add meaning when HTML has no fitting element. The first rule of ARIA: use native HTML when you can.
Related lessons
Need a website built or fixed while you practice? The team at Remar Digital can help.