What are Semantic Elements?
Semantic HTML elements clearly describe their meaning in a web page. They improve readability, accessibility, and SEO.
Why Use Semantic HTML?
- Improves SEO – Search engines understand content better
- Enhances Accessibility – Screen readers interpret structure correctly
- Better Code Readability – Developers understand layout easily
- Cleaner Structure – Organized and maintainable code
Common Semantic Elements
| Tag | Purpose |
|---|---|
| <header> | Top section of a page |
| <nav> | Navigation links |
| <main> | Main content area |
| <section> | Section of content |
| <article> | Independent content |
| <aside> | Sidebar content |
| <footer> | Bottom section |
Example Layout
HTMLRead-only
1
Semantic vs Non-Semantic
| Type | Example |
|---|---|
| Semantic | <header>, <article>, <section> |
| Non-Semantic | <div>, <span> |
Accessibility Benefits
Semantic elements help screen readers and assistive technologies understand page structure, making websites more inclusive.
Best Practices
- Use semantic tags instead of div when possible
- Follow proper structure (header → main → footer)
- Use nav for navigation menus only
- Use article for independent content
- Avoid overusing section without purpose
Common Mistakes
- Using div instead of semantic tags
- Misusing section and article
- Incorrect nesting of elements
- Ignoring accessibility considerations
Conclusion
Semantic HTML improves structure, SEO, and accessibility. Using meaningful tags helps build modern, maintainable web applications.