Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
Text Content  ›  Lesson

Headings: h1 to h6

h1 to h6 12 minThe six heading elements form an outline of the page, with one h1 for the page's topic and lower levels for nested subsections, never skipping levels for the sake of size.

Headings: h1 to h6

Many screen reader users move through a page by jumping from heading to heading, the way sighted readers skim bold titles. If your headings form a clear outline, the page is easy to scan for everyone. If they are chosen for their font size, the outline turns into nonsense.

The rule

Headings are an outline: one h1, then nest down without skipping.

HTML has six heading levels, <h1> to <h6>. Level 1 is the most important, level 6 the least. Think of them as the numbered structure of a report:

<h1>Travelling in Kerala</h1>
  <h2>Backwaters</h2>
  <h2>Food</h2>
    <h3>Breakfast</h3>
    <h3>Seafood</h3>
  <h2>When to visit</h2>

(The indentation here only shows the outline; in a real page the headings sit among paragraphs.)

Three rules follow from the rule:

  1. One h1 per page, naming what the page is about. It usually matches the <title>, closely if not exactly.
  2. Go down one level at a time. After an h2, the next deeper heading is h3, not h4. You can jump back up any number of levels when a new section starts.
  3. Level means rank, not size. Browsers make h1 large by default, but you can restyle any heading with CSS. If you want smaller text for a top-level section, use h2 and change the size with CSS; do not reach for h5.

The shortcut

Before writing headings, write the page as a numbered outline. The depth of each item is its heading level.

From outline to headingsStep 1 of 4
  1. Write the outline

    1 Guide to houseplants; 1.1 Light; 1.2 Water; 1.2.1 Summer; 1.2.2 Winter; 1.3 Soil.

The trap is picking a heading level because of its default size, or using a heading just to make any text bold. If the text does not introduce a section, it is not a heading.

Headings pay off twice. Screen reader users can press a single key to jump to the next heading, or pull up a list of every heading on the page and pick one. Search engines also treat headings as strong hints about what each part of the page covers. A clean outline serves both at no extra cost.

Drills

Answer fast — trust the rule.

quick drill

How many h1 elements should a typical page have?

quick drill

A page has an h2 called "Pricing". Its subsection "Student discounts" needs a heading. Which level?

quick drill

You want a top-level section heading to look smaller than the default h2. What should you do?

quick drill

Which heading sequence skips a level?

Remember

  • Headings form an outline: one h1, then h2, h3 and deeper, one level at a time.
  • Shortcut: write a numbered outline first; the depth of each item is its level.
  • Trap: choosing a heading for its size, or using headings just to make text bold.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainOutline a page with headings

Plan the headings for a travel page about Kerala with sections on backwaters, food (with subsections for breakfast and seafood) and when to visit. Write the heading levels you would use and explain why.