HTML Semantic Elements
Semantic elements clearly describe their meaning to both the browser and the developer. Learn all 10 HTML5 semantic tags — header, nav, main, section, article, aside, footer, details, summary, and mark — with examples and a full reference table.
- What Are Semantic Elements?
- Why Use Semantic Tags?
- Semantic vs Non-Semantic
- Semantic Tag Structure
- All 10 Semantic Elements
- Full Code Example
- Reference Table
- Related Lessons
- Try It Yourself
- FAQ
What Are Semantic Elements?
A semantic element clearly describes its meaning to both the browser and the developer. The word "semantic" comes from the Greek word meaning "significant" — and that's exactly what these elements are: meaningful.
HTML semantics refers to tags that provide meaning to an HTML page rather than just presentation. They make HTML more comprehensible by better defining the different sections and layout of web pages — telling everyone (developers, browsers, search engines, and screen readers) exactly what role each piece of content plays. This is the final lesson of the TipsInLearning HTML course — and semantic HTML ties everything together.
Why Use Semantic Tags in HTML?
There are several important advantages to using semantic tags instead of generic containers like <div>. In earlier lessons like HTML Layout you used divs for structure — semantic elements replace many of those with meaningful alternatives.
Better SEO
Semantic HTML tags help search engines determine the importance and context of web pages — boosting your rankings significantly.
Easier to Read
Pages made with semantic elements are much easier to read and maintain — both for you and other developers on your team.
Greater Accessibility
Screen readers and assistive technologies use semantic tags to navigate and read content correctly — improving the experience for everyone.
Semantic vs Non-Semantic Elements
The key difference is whether an element communicates its purpose through its tag name alone:
Tags like <div> and <span> tell nothing about the content they contain. They are purely structural containers with no meaning.
Tags like <form>, <table>, and <article> clearly define their content — anyone reading the HTML instantly understands what's inside.
<!-- ❌ Non-semantic: tells nothing about the content --> <div id="header">Site Title</div> <div id="nav">Navigation...</div> <div id="content">Main Content...</div> <!-- ✅ Semantic: instantly clear what each section is --> <header>Site Title</header> <nav>Navigation...</nav> <main>Main Content...</main>
HTML Semantic Tag Structure
The following semantic tags can be used to break your page into clearly identified parts. Here is how they typically fit together in a complete webpage layout:
All 10 HTML Semantic Elements
HTML5 introduced a full set of semantic elements to replace generic <div> containers. Here are all 10 you need to know:
Let's explore each one in detail:
<header> — Page or Section Header
Defines a header for a web page or section. It typically contains a logo, site title, and top navigation. A page can have multiple <header> elements — one for the page, one inside each <article> or <section>.
<nav> — Navigation Links
Defines a container for navigation links. Use it for primary site menus, breadcrumbs, or any group of links that help users navigate the site. Not all link groups need <nav> — only use it for major navigation blocks.
<main> — Primary Page Content
Specifies the main content of the page. It should be unique to the document and exclude anything repeated across pages (like headers, footers, or navigation). There should be only one <main> per page.
<section> — Thematic Section
Defines a section in a web page — a thematic grouping of content, typically with its own heading. Use it to divide your main content into meaningful chapters or topic areas. Think of it like chapters in a book.
<article> — Independent Content
Contains the main self-contained content that could be distributed or reused independently — such as a blog post, news article, forum post, or product card. It should make complete sense on its own, outside the page context.
<aside> — Sidebar Content
The <aside> content is often placed as a sidebar in a document. It contains content that is indirectly related to the main content — like related links, author bios, advertisements, or supplementary notes.
<footer> — Page or Section Footer
Defines a footer for a document or section. It typically contains copyright information, contact details, social media links, or site maps. Like <header>, a page can have multiple <footer> elements.
<details> — Collapsible Content
Specifies a tag for additional details that the user can show or hide on demand. It creates a native HTML collapsible widget — no JavaScript required. Always pair it with a <summary> element for the visible label.
<summary> — Details Label
Specifies a header for the <details> element. It is the visible, clickable label that the user sees before expanding the collapsible section. The <summary> must always be the first child of <details>.
<mark> — Highlighted Text
Specifies text that is highlighted or marked for reference purposes. Browsers render it with a yellow background by default. It's useful for drawing attention to search terms or key phrases. You also learned about <mark> in the HTML Text Formatting lesson.
Full Code Example
Here is a complete HTML5 example using all key semantic elements together to build a structured webpage:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>TipsInLearning</title> </head> <body> <header> <h1>TipsInLearning</h1> <p>Free Web Development Tutorials</p> </header> <nav> <a href="#">Home</a> | <a href="#">HTML</a> | <a href="#">CSS</a> </nav> <main> <section> <h2>Welcome to TipsInLearning</h2> <article> <h3>HTML Lesson 1: Introduction</h3> <p>HTML is the <mark>foundation</mark> of every website.</p> <details> <summary>Read more about HTML</summary> <p>HTML stands for HyperText Markup Language.</p> </details> </article> </section> <aside> <h3>Related Links</h3> <ul> <li><a href="#">HTML Basics</a></li> <li><a href="#">CSS Guide</a></li> </ul> </aside> </main> <footer> <p>© 2026 TipsInLearning. All rights reserved.</p> </footer> </body> </html>
Welcome to TipsInLearning
HTML Lesson 1: Introduction
HTML is the foundation of every website.
Read more about HTML
HTML stands for HyperText Markup Language.
- HTML Basics
- CSS Guide
HTML Semantic Elements Reference Table
Here is a complete reference of all HTML semantic elements and what they do:
| Tag | Explanation |
|---|---|
| <article> | Specifies independent, self-contained content — such as a blog post, news article, or product card. |
| <nav> | Defines a set of navigation links for site menus or breadcrumbs. |
| <aside> | Defines content aside from the main page content, often used as a sidebar with related links or notes. |
| <section> | Represents a thematic section of a document — a chapter, tab panel, or grouped content with a heading. |
| <details> | Creates a collapsible disclosure widget. The user can show or hide the additional details — no JavaScript needed. |
| <header> | Represents a container for introductory content or a set of navigational links at the top of a page or section. |
| <footer> | Defines a footer for a document or section — copyright, contact info, or sitemap links. |
| <main> | Specifies the main page content. Should be unique to the document and appear only once per page. |
| <summary> | Specifies a visible header/label for the <details> element. Must be its first child element. |
| <mark> | Specifies text that is highlighted or marked for reference — rendered with a yellow background by default. |
Related HTML Lessons
Semantic HTML works best when combined with proper content structure. These lessons from the TipsInLearning HTML course connect directly with what you've just learned:
Try It Yourself
Frequently Asked Questions
The questions TipsInLearning students ask most about HTML semantic elements: