Blog Post Title
Published on January 15, 2024
Blog post content that is self-contained and could be distributed independently...
Semantic HTML elements clearly describe their meaning to both the browser and the developer. They improve accessibility, SEO, and make code more maintainable by providing better structure and meaning.
Screen readers and assistive technologies understand the structure and purpose of content.
Search engines better understand content structure and importance.
Clear structure makes code easier to read, understand, and maintain.
Semantic elements adapt better to new devices and technologies.
<div id="header">
<div class="nav">
<div class="logo">Logo</div>
<div class="menu">
<div class="menu-item">Home</div>
<div class="menu-item">About</div>
</div>
</div>
</div>
<div id="main">
<div class="content">
<div class="post">
<div class="post-title">Title</div>
<div class="post-content">Content</div>
</div>
</div>
</div>
<div id="footer">
<div class="copyright">Copyright</div>
</div><header>
<nav>
<div class="logo">Logo</div>
<ul class="menu">
<li><a href="#home">Home</a></li>
<li><a href="#about">About</a></li>
</ul>
</nav>
</header>
<main>
<article>
<h1>Title</h1>
<p>Content</p>
</article>
</main>
<footer>
<p>Copyright</p>
</footer>Represents introductory content or navigational links.
<!-- Site header -->
<header>
<h1>Website Title</h1>
<p>Website slogan or description</p>
</header>
<!-- Article header -->
<article>
<header>
<h2>Article Title</h2>
<p>By Author Name • Published Date</p>
</header>
<p>Article content...</p>
</article>
<!-- Section header -->
<section>
<header>
<h3>Section Title</h3>
<p>Section introduction</p>
</header>
<p>Section content...</p>
</section>
<!-- With navigation -->
<header>
<div class="logo">MySite</div>
<nav>
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#about">About</a></li>
</ul>
</nav>
</header>Website slogan or description
Represents a section with navigation links.
<!-- Main navigation -->
<nav>
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#services">Services</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</nav>
<!-- Breadcrumb navigation -->
<nav aria-label="Breadcrumb">
<ol>
<li><a href="#home">Home</a></li>
<li><a href="#products">Products</a></li>
<li>Current Product</li>
</ol>
</nav>
<!-- Footer navigation -->
<footer>
<nav>
<ul>
<li><a href="#privacy">Privacy Policy</a></li>
<li><a href="#terms">Terms of Service</a></li>
</ul>
</nav>
</footer>
<!-- With ARIA labels -->
<nav aria-label="Main navigation">
<!-- Navigation content -->
</nav>
<nav aria-label="Social media links">
<!-- Social links -->
</nav>Represents the dominant content of the document.
<!-- Basic main element -->
<main>
<h1>Main Content Heading</h1>
<p>Main content of the document...</p>
</main>
<!-- With multiple sections -->
<main>
<section>
<h2>Introduction</h2>
<p>Introductory content...</p>
</section>
<section>
<h2>Features</h2>
<p>Feature descriptions...</p>
</section>
</main>
<!-- Important: Only one main element per page -->
<body>
<header>...</header>
<main>
<!-- Unique main content -->
</main>
<footer>...</footer>
</body>
<!-- With ARIA role (redundant but explicit) -->
<main role="main">
<!-- Main content -->
</main>Represents self-contained, reusable content.
<!-- Blog post -->
<article>
<header>
<h2>Blog Post Title</h2>
<p>Published on <time datetime="2024-01-15">January 15, 2024</time></p>
</header>
<p>Blog post content...</p>
<footer>
<p>Posted in: Technology</p>
</footer>
</article>
<!-- News article -->
<article>
<h2>Breaking News</h2>
<p>News content that can be syndicated...</p>
</article>
<!-- Forum post -->
<article>
<header>
<h3>Forum Discussion</h3>
<p>By User123</p>
</header>
<p>Discussion content...</p>
</article>
<!-- Product card -->
<article class="product-card">
<h3>Product Name</h3>
<p>Product description...</p>
<span>$99.99</span>
</article>
<!-- Multiple articles -->
<section>
<h2>Latest News</h2>
<article>...</article>
<article>...</article>
<article>...</article>
</section>Published on January 15, 2024
Blog post content that is self-contained and could be distributed independently...
Represents a thematic grouping of content.
<!-- Thematic sections -->
<section>
<h2>Introduction</h2>
<p>Introductory content...</p>
</section>
<section>
<h2>Features</h2>
<article>...</article>
<article>...</article>
</section>
<section>
<h2>Testimonials</h2>
<blockquote>...</blockquote>
<blockquote>...</blockquote>
</section>
<!-- With ARIA landmarks -->
<section aria-labelledby="features-heading">
<h2 id="features-heading">Features</h2>
<!-- Features content -->
</section>
<!-- Nested sections -->
<section>
<h2>Main Section</h2>
<section>
<h3>Subsection</h3>
<p>Subsection content...</p>
</section>
</section>
<!-- Section vs Article: -->
<!-- Use section for thematic grouping -->
<!-- Use article for self-contained content -->Represents content indirectly related to the main content.
<!-- Sidebar content -->
<aside>
<h3>Related Articles</h3>
<ul>
<li><a href="#article1">Article 1</a></li>
<li><a href="#article2">Article 2</a></li>
</ul>
</aside>
<!-- Pull quotes -->
<aside>
<blockquote>
"This is an important quote from the article."
</blockquote>
</aside>
<!-- Advertisement -->
<aside>
<h3>Sponsored Content</h3>
<p>Advertisement content...</p>
</aside>
<!-- Author bio -->
<aside>
<h3>About the Author</h3>
<p>Author biography...</p>
</aside>
<!-- Within article -->
<article>
<h2>Main Article</h2>
<p>Article content...</p>
<aside>
<h3>Did You Know?</h3>
<p>Interesting side note...</p>
</aside>
</article>Represents footer content for its nearest section.
<!-- Site footer -->
<footer>
<p>© 2024 Company Name. All rights reserved.</p>
<nav>
<ul>
<li><a href="#privacy">Privacy Policy</a></li>
<li><a href="#terms">Terms of Service</a></li>
</ul>
</nav>
</footer>
<!-- Article footer -->
<article>
<h2>Article Title</h2>
<p>Article content...</p>
<footer>
<p>Published on January 15, 2024</p>
<p>Category: Technology</p>
</footer>
</article>
<!-- Section footer -->
<section>
<h2>Section Title</h2>
<p>Section content...</p>
<footer>
<p>Last updated: January 2024</p>
</footer>
</section>
<!-- Contact information -->
<footer>
<address>
Contact: <a href="mailto:info@example.com">info@example.com</a>
</address>
</footer>For images, diagrams, code with captions
<figure>
<img src="image.jpg">
<figcaption>Image caption</figcaption>
</figure>For dates and times
<time datetime="2024-01-15">Jan 15, 2024</time>For highlighted text
<mark>Important text</mark>For collapsible content
<details>
<summary>Title</summary>
<p>Content</p>
</details><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Semantic HTML Example</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: Arial, sans-serif; line-height: 1.6; }
header { background: #2c3e50; color: white; padding: 1rem; }
nav ul { display: flex; list-style: none; gap: 1rem; }
nav a { color: white; text-decoration: none; }
main { padding: 2rem; max-width: 1200px; margin: 0 auto; }
article { margin-bottom: 2rem; padding: 1rem; border: 1px solid #ddd; }
aside { background: #f8f9fa; padding: 1rem; border-radius: 5px; }
footer { background: #34495e; color: white; text-align: center; padding: 1rem; }
</style>
</head>
<body>
<header>
<h1>My Blog</h1>
<nav aria-label="Main navigation">
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</nav>
</header>
<main>
<article>
<header>
<h2>Understanding Semantic HTML</h2>
<p>Published on <time datetime="2024-01-15">January 15, 2024</time></p>
</header>
<section>
<h3>Introduction</h3>
<p>Semantic HTML provides meaning to web content...</p>
</section>
<section>
<h3>Benefits</h3>
<p>Improved accessibility, better SEO, and cleaner code...</p>
</section>
<figure>
<img src="semantic-html.jpg" alt="Semantic HTML structure diagram">
<figcaption>Figure 1: Semantic HTML structure</figcaption>
</figure>
<footer>
<p>Category: Web Development</p>
<p>Tags: HTML, Accessibility, SEO</p>
</footer>
</article>
<aside>
<h3>About the Author</h3>
<p>John Doe is a web developer with 10 years of experience...</p>
<h3>Related Articles</h3>
<ul>
<li><a href="#html5">HTML5 Features</a></li>
<li><a href="#accessibility">Web Accessibility</a></li>
</ul>
</aside>
</main>
<footer>
<p>© 2024 My Blog. All rights reserved.</p>
<nav aria-label="Footer navigation">
<ul>
<li><a href="#privacy">Privacy Policy</a></li>
<li><a href="#terms">Terms of Service</a></li>
</ul>
</nav>
</footer>
</body>
</html><main> per page<header> and <footer> appropriately<div> when semantic elements are appropriate<main> elementsHTML validation service
Accessibility and SEO auditing
Accessibility testing tool
NVDA, JAWS, VoiceOver testing