HTML Notes
Master semantic HTML5 elements — article, section, aside, header, footer, main, nav, figure, time, address — understand why semantics matter for SEO, accessibility, and maintainability with real-world page structure examples.
Semantic HTML means using elements that describe the meaning and purpose of content, not just its appearance. A <div> tells the browser nothing. An <article> says: "this is a self-contained piece of content." A <nav> says: "this is navigation." That meaning benefits search engines, screen readers, and developers reading your code.
The Core Semantic Layout Elements
<header>
The introductory content of a page or section. Can appear at the top of the page, or inside an <article> / <section>:
<footer>
Closing content for a page or section — author info, copyright, related links:
<main>
The dominant content of the page — the central topic. Only one <main> per page. It should not contain navigation, headers, or footers:
id="main-content" is a convention for skip navigation links:
<a href="#main-content" class="skip-link">Skip to main content</a><nav>
Navigation links — site menus, breadcrumbs, table of contents, pagination. Not every group of links needs <nav> — only major navigation blocks:
Use aria-label on each <nav> if there are multiple on the page — screen readers use it to differentiate them.
Content Sectioning Elements
<article>
A self-contained, independently distributable piece of content. If you could copy it to another site and it still makes complete sense on its own, it's an <article>:
- Blog post
- News article
- Forum post
- Comment
- Product card
- Tutorial
<article>
<header>
<h2>Getting Started with React Hooks</h2>
<p>By <strong>Arjun Mehta</strong> ·
<time datetime="2026-06-20">June 20, 2026</time> ·
8 min read</p>
</header>
<p>React Hooks revolutionised how we write functional components...</p>
<section>
<h3>useState Hook</h3>
<p>The useState hook lets you add state to functional components...</p>
</section>
<footer>
<p>Filed under: <a href="/react">React</a>, <a href="/javascript">JavaScript</a></p>
</footer>
</article><section>
A thematic grouping of content, typically with a heading. Used to break a long article or page into logical parts:
<main>
<h1>HTML Complete Guide</h1>
<section id="introduction">
<h2>Introduction</h2>
<p>HTML is the foundation of every webpage...</p>
</section>
<section id="elements">
<h2>Core Elements</h2>
<p>HTML uses tags to define elements...</p>
</section>
<section id="forms">
<h2>Forms and User Input</h2>
<p>Forms allow users to interact with your page...</p>
</section>
</main><article> vs <section> — The Key Difference
| Element | When to use |
|---|---|
<article> | Content that is self-contained — makes sense on its own |
<section> | A thematic group within a larger piece — does not stand alone |
A page of blog posts: each post is an <article>. Inside one post, chapters are <section>.
<aside>
Content tangentially related to the main content — a sidebar, pull quote, biography box, related articles panel:
Text-Level Semantic Elements
<time>
Represents a specific time or date. The datetime attribute provides a machine-readable version:
The datetime format:
- Date:
YYYY-MM-DD(e.g.,2026-06-15) - Time:
HH:MM(e.g.,14:30) - Date + time:
YYYY-MM-DDTHH:MM(e.g.,2026-06-15T14:30) - Duration:
PTnHnM(e.g.,PT2H30M= 2 hours 30 minutes)
<address>
Contact information for the nearest <article> or <body>:
<address>
WoHoTech Learning Platform<br>
123 Tech Park, Koramangala<br>
Bengaluru, Karnataka 560095<br>
India<br>
<a href="mailto:hello@wohotech.in">hello@wohotech.in</a><br>
<a href="tel:+918012345678">+91 80 1234 5678</a>
</address><figure> and <figcaption>
Groups media content (image, video, code, chart) with its caption:
Complete Page Structure Example
A real-world, semantically correct blog page:
Semantic Elements Cheat Sheet
| Element | Category | Use For |
|---|---|---|
<header> | Layout | Page or section header |
<footer> | Layout | Page or section footer |
<main> | Layout | Primary page content (one per page) |
<nav> | Layout | Major navigation blocks |
<article> | Content | Self-contained content |
<section> | Content | Thematic grouping with heading |
<aside> | Content | Supplementary, tangential content |
<figure> | Media | Media with caption |
<figcaption> | Media | Caption for figure |
<time> | Inline | Dates and times |
<address> | Contact | Contact information |
<mark> | Inline | Highlighted text |
<details> | Interactive | Expandable disclosure widget |
<summary> | Interactive | Visible heading for <details> |
<dialog> | Interactive | Modal or popup dialog |
Summary
- Use
<header>,<footer>,<main>,<nav>for page-level structure - Use
<article>for self-contained content,<section>for thematic groups within content - Use
<aside>for sidebars, pull quotes, and supplementary content - Add
aria-labelwhen multiple<nav>or<aside>elements exist on the page - Use
<time datetime="...">for all dates — thedatetimeattribute makes it machine-readable - Semantic HTML is the single highest-impact change for accessibility and SEO
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for Semantic HTML5 — Elements, Structure, SEO, and Accessibility.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this HTML Complete Guide topic.
Search Terms
html-complete-guide, html complete guide, html, complete, guide, semantic, semantic html5 — elements, structure, seo, and accessibility
Related HTML Complete Guide Topics