Your HTML Deserves Better Than Just Divs!

If you're learning HTML or building websites, you've probably come across the terms semantic and non-semantic HTML. At first, it might sound confusing — but don’t worry, it's actually pretty simple.

Let’s understand what these are, how they’re different, and why semantic HTML is considered a best practice in web development.

What is Semantic HTML?

Semantic HTML means using HTML elements that clearly describe their meaning in a way that both the browser and humans can understand.

For example:

  • <header> tells us this is the top section of a page.

  • <nav> means it's for navigation links.

  • <article> is for an independent piece of content.

  • <footer> is for the bottom section.

other semantic tags

These tags give meaning to your content. Even if someone is just looking at the code, they’ll understand what each part is doing — without guessing.

What is Non-Semantic HTML?

Non-semantic HTML, on the other hand, uses elements that don’t tell you anything about the content.

Example:

  • <div>

  • <span>

These are generic containers. They don’t say what the content is — just that something is there. You have to use class names or IDs to explain the purpose (like <div class="header">), which isn’t as clear.

Comparison of Non-Semantic vs Semantic HTML

Let’s see a example Below are two versions of a simple web page: one using non-semantic HTML, and the other using semantic HTML. Both display the same layout — a header, navigation menu, main content, and a footer.

Non-Semantic HTML

Semantic HTML

Lighthouse Comparison

When we compare Non-Semantic HTML with Semantic HTML using Lighthouse, the impact is clearly visible—especially in Accessibility and SEO scores.

By simply replacing generic <div> tags with meaningful semantic elements like <header>, <nav>, <main>, and <footer>, we saw noticeable improvements:

  • Accessibility Score improved from 89 → 100(↑ 12.36%)
    This means the page became fully accessible to screen readers and assistive technologies. Semantic tags help define clear landmarks and structure, making navigation easier for all users.

  • SEO Score increased from 82 → 91(↑ 10.98%)
    Search engines now understand the page structure better, which helps with proper indexing and ranking.

Which one should be used when?

Semantic

You should use semantic HTML whenever possible. It improves code readability, accessibility, and SEO — all without extra effort. If there's a semantic tag that fits your use case, use it — it helps both humans and machines understand your page better.

Non-Semantic

Sometimes, you do need <div> or <span>, especially when you’re styling small sections or wrapping things. They’re useful — just don’t overuse them. Try to go semantic wherever possible.

In short: Key Differences

FeatureSemantic HTMLNon-Semantic HTML
Meaning in tag?YesNo
Easier to read?YesNo
Helps with SEO?YesNot really
Good for accessibility?YesNeeds extra effort
0
Subscribe to my newsletter

Read articles from yashwanth venkat directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

yashwanth venkat
yashwanth venkat