Overview - Semantic vs non-semantic elements
What is it?
Semantic elements in HTML clearly describe their meaning to both the browser and the developer, like or . Non-semantic elements, like
and , do not provide any information about their content. Semantic elements help organize content in a meaningful way, improving accessibility and SEO. Non-semantic elements are used mainly for styling or grouping without meaning.
Why it matters
Without semantic elements, web pages would be harder to understand for screen readers, search engines, and developers. This would make websites less accessible to people with disabilities and harder to maintain or improve. Semantic elements create a shared language between humans and machines, making the web more usable and inclusive.
Where it fits
Before learning this, you should know basic HTML tags and structure. After this, you can learn about accessibility, SEO best practices, and advanced HTML5 features that rely on semantic tags.
Mental Model
Core Idea
Semantic elements give meaning to content, while non-semantic elements are just containers without meaning.
Think of it like...
Semantic elements are like labeled folders in a filing cabinet telling you exactly what's inside, while non-semantic elements are like plain boxes with no labels.
┌───────────────┐ ┌───────────────┐ │ Semantic │ │ Non-semantic │ │ Elements │ │ Elements │ ├───────────────┤ ├───────────────┤ │ <header> │ │ <div> │ │ <nav> │ │ <span> │ │ <article> │ │ <div> │ │ <footer> │ │ <span> │ └───────────────┘ └───────────────┘
Build-Up - 7 Steps