Heading Hierarchy (h1-h6)
What you'll learn: How to create a logical structure for your documents using the six levels of heading elements without skipping levels.
The Core Idea
HTML provides six heading elements: <h1>, <h2>, <h3>, <h4>, <h5>, and <h6>. Think of them like an outline for a book report—your main title is the biggest (h1), major sections use h2, subsections under those use h3, and so on. Each number represents a level in your document's hierarchy, with <h1> being the most important and <h6> the least.
Creating a Logical Outline
You should have one <h1> per page—this is your document's main title. From there, structure content like nested chapters:
<h1>My Website About Dogs</h1>
<h2>Different Breeds</h2>
<h3>Small Breeds</h3>
<h3>Large Breeds</h3>
<h2>Dog Training Tips</h2>
<h3>Basic Commands</h3>
<h4>Teaching "Sit"</h4>
<h4>Teaching "Stay"</h4>
Never Skip Levels
Don't jump from <h2> directly to <h5>. Always move down one level at a time. Think of it like a numbered outline—you wouldn't go from section 1 to section 1.1.1.1 without having 1.1 first. Skipping levels confuses screen readers that help visually impaired users navigate your page.
Wrong:
<h1>Title</h1>
<h4>Subsection</h4> <!-- Skipped h2 and h3! -->
Right:
<h1>Title</h1>
<h2>Subsection</h2>
Headings aren't about visual size—CSS handles that. They're about meaning and structure, helping browsers and assistive technologies understand how your content is organized.
Key Takeaway: Use heading elements (h1-h6) to create a logical document outline, starting with one h1 and moving down one level at a time without skipping—this creates semantic structure, not just visual hierarchy.