Skip to the workspace
Pebellslearn by building
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.

html / Headings: h1 to h6

Explore each scene at your own pace.

01 · The rule

The rule

Headings: h1 to h6

The 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.

Create a meaningful heading hierarchy rather than choosing levels by visual size.

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.
Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.