Skip to content

02. Layout Tags

HTML5 introduced semantic layout elements that describe the structure and purpose of different sections of a web page. These elements replace generic <div> containers with meaningful tags that help browsers, search engines, and assistive technologies understand page structure. Using layout tags creates more accessible, maintainable, and SEO-friendly websites.

Site or section header:

<header>
<h1>Site Title</h1>
<nav>Navigation</nav>
</header>

Navigation links:

<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/about">About</a></li>
</ul>
</nav>

Main content area:

<main>
<article>
<h1>Article Title</h1>
<p>Content...</p>
</article>
</main>

Independent, self-contained content:

<article>
<h1>Blog Post Title</h1>
<p>Post content...</p>
</article>

Thematic grouping:

<section>
<h2>Introduction</h2>
<p>Content...</p>
</section>

Sidebar or complementary content:

<aside>
<h2>Related Articles</h2>
<ul>...</ul>
</aside>

Site or section footer:

<footer>
<p>&copy; 2024 My Site</p>
</footer>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Layout Example</title>
</head>
<body>
<header>
<h1>Site Title</h1>
<nav>Navigation</nav>
</header>
<main>
<article>
<header>
<h1>Article Title</h1>
</header>
<section>
<h2>Section 1</h2>
<p>Content...</p>
</section>
</article>
<aside>
<h2>Sidebar</h2>
<p>Related content...</p>
</aside>
</main>
<footer>
<p>Footer content</p>
</footer>
</body>
</html>

Use only one <main> element per page:

<body>
<header>...</header>
<main>Main content</main>
<footer>...</footer>
</body>

Maintain logical hierarchy:

<article>
<header>Article header</header>
<section>Article section</section>
<footer>Article footer</footer>
</article>