What is Semantic HTML?
Semantic HTML uses elements that clearly describe their meaning to both browsers and developers. It improves accessibility, SEO, and code maintainability.
Semantic vs Non-Semantic
Loading HTML Playground...
Loading HTML Playground...
Why Semantic HTML Matters
For Accessibility:
- Screen readers announce element types
- Users can navigate by landmarks
- Content has context
For SEO:
- Search engines understand content structure
- Better indexing of important content
- Improved search rankings
For Developers:
- Self-documenting code
- Easier to maintain
- Consistent patterns
Common Semantic Elements
Loading HTML Playground...
Landmark Elements
Loading HTML Playground...
Landmark elements help users navigate:
<header>- Introductory content<nav>- Navigation section<main>- Primary content (one per page)<aside>- Tangentially related content<footer>- Closing content
The Outline Algorithm
Loading HTML Playground...
Good document outline:
- Site Title (h1)
- Article One (h2)
- Section 1.1 (h3)
- Section 1.2 (h3)
- Article Two (h2)
- Article One (h2)
Div and Span Still Have Uses
Loading HTML Playground...
<div> and <span> are for:
- Styling hooks
- JavaScript targets
- Layout containers
- When no semantic element applies
Exercise: Convert to Semantic HTML
Convert div-based structure to semantic HTML:
Loading HTML Exercise...
Semantic HTML communicates meaning and improves the web for everyone!

