DevPrep
  • Interview Prep
  • Projects
  • Resources
  • Pricing
  • About Us
Submit Question
DevPrep
  • Pricing
  • About Us
Submit Question
  1. Home
  2. Articles
  3. Frontend Engineering
  4. Semantic HTML: Why It Matters More Than You Think
XLinkedInReddit
MediumFrontend Engineering

Semantic HTML: Why It Matters More Than You Think

D
DevPrep Team
February 10, 2026·1 min read·0
Table of Contents
  • Semantic vs Non-Semantic
  • Essential Semantic Elements
  • Form Semantics
  • SEO Benefits
  • The Heading Hierarchy Rule

Semantic HTML isn't just about accessibility — it affects SEO, maintainability, and even performance. At Google, we consider it a fundamental skill.

Semantic vs Non-Semantic

<!-- Non-semantic (div soup) -->
<div class="header">
  <div class="nav">
    <div class="nav-item">Home</div>
  </div>
</div>
<div class="main">
  <div class="article">
    <div class="title">Hello</div>
  </div>
</div>

<!-- Semantic -->
<header>
  <nav>
    <a href="/">Home</a>
  </nav>
</header>
<main>
  <article>
    <h1>Hello</h1>
  </article>
</main>

Essential Semantic Elements

ElementPurposeCommon Mistake
<header>Introductory contentUsing only for page header (can be in article too)
<nav>Navigation linksWrapping every link group (only major nav)
<main>Primary content (one per page)Multiple <main> elements
<article>Self-contained contentUsing for non-independent content
<section>Thematic groupingUsing instead of <div> for styling
<aside>Related but tangential contentUsing only for sidebars
<figure>Self-contained illustrationNot using <figcaption>
<time>Date/timeNot using datetime attribute

Form Semantics

<form>
  <fieldset>
    <legend>Personal Information</legend>
    <label for="name">Name</label>
    <input id="name" type="text" required autocomplete="name" />
    
    <label for="email">Email</label>
    <input id="email" type="email" required autocomplete="email" />
  </fieldset>
  <button type="submit">Submit</button>
</form>

SEO Benefits

  • Search engines understand content structure better
  • <article> content can appear in Google Discover
  • <nav> helps crawlers identify navigation patterns
  • Proper heading hierarchy (h1→h6) improves content indexing
  • <time datetime="..."> enables rich snippets

The Heading Hierarchy Rule

Every page should have exactly one <h1>. Headings should not skip levels (h1 → h3 without h2). Each section can restart at h1 using <article> or <section>, but in practice, keep a single h1 per page for SEO.

Related Articles

MediumFrontend Engineering

System Design #12: Design a Multi-Step Form Wizard

7 min read
MediumFrontend Engineering

Mastering Senior-Level JavaScript Interview Concepts

2 min read
MediumFrontend Engineering

System Design #9: Design a Collaborative Text Editor

9 min read

Comments (0)

Sign in to leave a comment.

No comments yet. Be the first to comment.

Table of Contents

  • Semantic vs Non-Semantic
  • Essential Semantic Elements
  • Form Semantics
  • SEO Benefits
  • The Heading Hierarchy Rule

Series

View all Frontend Engineering articles →

Practice

  • JavaScript
  • DSA
  • Machine Coding
  • System Design

Resources

  • Learning Tracks
  • Articles
  • Roadmaps
  • Compare Concepts
  • Glossary
  • Developer Tools
  • All Questions

Company

  • About
  • Pricing

Legal

  • Privacy Policy
  • Terms of Service
DevPrep

© 2026 DevPrep. All rights reserved.