Lesson 9 of 51 · Module 2, lesson 3 of 9 · 4 min
Headings and the page outline
Use the six heading levels to give your page a clear outline that everyone can navigate.
What you'll learn
- The six heading levels,
<h1>to<h6>- How headings create an outline of your page
- Why you choose a heading level by meaning, not by size
Why this matters
Most readers look at the headings first, to decide what to read. People who use a screen reader do the same: they jump from heading to heading, like using a table of contents. Search engines also use headings to understand what a page is about. Good headings help everyone.
Six levels
HTML has six heading elements, from most important to least important:
<h1>Main title of the page</h1>
<h2>A section</h2>
<h3>A part of that section</h3>
<h4>A smaller part</h4>
<h5>An even smaller part</h5>
<h6>The smallest level</h6>
Browsers show <h1> largest and <h6> smallest. Most pages only need <h1>, <h2> and <h3>.
Headings make an outline
Look at this recipe page:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tomato soup</title>
</head>
<body>
<h1>Tomato soup</h1>
<p>A warm, simple soup for four people.</p>
<h2>Ingredients</h2>
<p>Six tomatoes, one onion, water and salt.</p>
<h2>Steps</h2>
<h3>Prepare the vegetables</h3>
<p>Cut the tomatoes and the onion into pieces.</p>
<h3>Cook the soup</h3>
<p>Cook everything in water for twenty minutes, then blend it.</p>
</body>
</html>
What you'll see: one large title, two medium section headings, and two smaller headings under "Steps".
If you list only the headings, you get an outline:
Three rules
- One
<h1>per page, for the main topic. It usually says the same thing as the<title>. - Do not skip levels going down. After
<h1>comes<h2>, not<h3>. You can go back up at any time: after an<h3>, a new<h2>starts a new section. - Choose the level by meaning, not by size. If a heading looks too big or too small, you will change its size with CSS later. Never pick
<h3>because "it looks nicer".
And the other way round: do not use a heading only to make text big or bold. A heading tells everyone "a new section starts here". If it is not a section title, it is not a heading.
Write useful heading text
A heading should say what the section is about. "Ingredients" is better than "Section 2". "Cook the soup" is better than "Next".
Try it yourself
- Select the recipe example and choose Try it.
- Add a new section at the end: an
<h2>called "Serving ideas", with one paragraph under it. - Open the developer tools on your own copy of the page (right-click → Inspect) and look at the headings in the Elements panel. Does the indentation of your outline match the levels?
Common mistakes
- Using headings for size. A bold warning written as
<h4>appears in the outline as if it were a section. Fix: use a paragraph, and make it bold with<strong>(you will learn it soon). - Skipping levels, such as
<h1>then<h3>. Screen reader users may think they missed a section. Fix: use the next level down. - Several
<h1>elements for decoration. The page no longer has one clear main topic. Fix: one<h1>; the rest are<h2>and below. - Empty headings, such as
<h2></h2>used to make space. A screen reader announces an empty heading. Fix: remove it. Space is a job for CSS.
Check yourself
- How many
<h1>elements should a page usually have? - A section heading comes after an
<h1>. Which level should it be? - You want a sentence to look bigger. Should you make it a heading?
Answers
- One.
<h2>.- No. Headings are for section titles. Size is a job for CSS.
Next: headings give the page its shape. Most of the text under them is paragraphs — and the browser has a surprising rule about spaces and line breaks in them.


