HTML Academy · Lesson

Headings h1-h6 and Their Hierarchy

Use heading levels to create meaningful document structure.

Lesson 1 of 413 steps

Headings h1-h6 and Their Hierarchy is a free HTML Academy lesson on CoddyKit. This is lesson 1 of 4. Any 3 lessons of this learning path are free to read in full — after that, CoddyKit PRO unlocks every lesson, plus hands-on practice with a built-in code editor and a 24/7 AI tutor. It is part of the HTML Academy learning path, and your progress syncs across the web and the CoddyKit app. The HTML Academy course includes 4 lessons in total.

The Six Heading Levels

HTML provides six heading elements from <h1> to <h6>:

  • h1 — Main page title (most important)
  • h2 — Major sections
  • h3 — Subsections
  • h4, h5, h6 — Deeper subsections (rarely needed)

They visually decrease in size, but size is controlled by CSS — not the number.

Semantic Hierarchy

Headings create a document outline — a table of contents for your page:

<h1>HTML Fundamentals</h1>
  <h2>Document Structure</h2>
    <h3>The html Element</h3>
    <h3>The head Element</h3>
  <h2>Text Elements</h2>
    <h3>Headings</h3>
    <h3>Paragraphs</h3>

The h1 Rule

Best practice for <h1>:

  • Use exactly one <h1> per page
  • It should match or closely relate to the <title> element
  • It is the primary topic of the page
  • Search engines weight it heavily for SEO

Do Not Skip Levels

Heading levels must be used in order — do not skip from h2 to h4:

<!-- Bad: skips h3 -->
<h2>Section</h2>
<h4>Subsection</h4>

<!-- Good: sequential order -->
<h2>Section</h2>
<h3>Subsection</h3>
<h4>Detail</h4>
<!-- Screen readers use outline order to navigate. Skipping breaks navigation. -->

Headings for Navigation

Screen reader users rely on headings to navigate long pages:

  • They jump between headings with the H key
  • Screen readers list all headings like a table of contents
  • Correct hierarchy makes the page navigable without sight

Style vs Semantics

Do not choose a heading level for its visual size — use CSS for that:

<!-- Bad: using h4 because it looks right -->
<h4 style="font-size: 2rem">Big Heading</h4>

<!-- Good: correct level, sized with CSS -->
<h1>Big Heading</h1>
<!-- CSS: h1 { font-size: 2rem; } -->

Headings in Sections

When using HTML5 sectioning elements, headings restart their hierarchy per section:

<article>
  <h2>Article Title</h2>    <!-- h2 within article -->
  <section>
    <h3>Subtopic</h3>       <!-- h3 within section -->
  </section>
</article>

<aside>
  <h2>Related Links</h2>   <!-- h2 in aside, independent section -->
</aside>

Heading Accessibility Tips

Follow these heading rules for accessibility:

  • Every page must have at least one heading
  • The main content area should start with an <h1>
  • Do not use headings just to make text bold or big
  • Do not use bold text as a substitute for headings

SEO and Headings

Search engines use headings to understand page content:

  • <h1> carries the most SEO weight
  • Include target keywords naturally in headings
  • Headings break up content and improve readability metrics
  • Search engines display headings in results (featured snippets)

Default Browser Styles

Browsers apply default styles to headings:

/* Default browser heading sizes (approximate) */
h1 { font-size: 2em;   font-weight: bold; }
h2 { font-size: 1.5em; font-weight: bold; }
h3 { font-size: 1.17em;font-weight: bold; }
h4 { font-size: 1em;   font-weight: bold; }
h5 { font-size: 0.83em;font-weight: bold; }
h6 { font-size: 0.67em;font-weight: bold; }

Headings in Navigation

Headings can also be used in navigation landmarks:

<nav aria-labelledby="nav-heading">
  <h2 id="nav-heading">Main Navigation</h2>
  <ul>
    <li><a href="/">Home</a></li>
    <li><a href="/about">About</a></li>
  </ul>
</nav>

Quick Check

How many h1 elements should a well-structured page typically have?

Recap: Headings

Heading hierarchy essentials:

  • Six levels: h1 through h6
  • One h1 per page — the main title
  • Use levels in order — never skip a level
  • Headings create an accessible document outline
  • Use CSS for visual size, not heading numbers
Free to start

Learn HTML with an AI tutor — free

Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.

Courses
40
Lessons
159

Frequently Asked Questions

Is the “Headings h1-h6 and Their Hierarchy” lesson free?

Yes — any 3 lessons of the HTML Academy learning path, including “Headings h1-h6 and Their Hierarchy”, are free to read in full here on the web. After that, CoddyKit PRO unlocks every lesson, plus interactive practice with a built-in code editor and a 24/7 AI tutor. The HTML Academy course includes 4 lessons in total.

What will I learn in “Headings h1-h6 and Their Hierarchy”?

Use heading levels to create meaningful document structure. You practise HTML Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start HTML Academy?

No prior experience is required. HTML Academy on CoddyKit is structured for beginners through advanced learners, so you can start here or from the beginning and move at your own pace. This is lesson 1 of 4.

How long does the “Headings h1-h6 and Their Hierarchy” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this HTML Academy lesson?

Yes. Every HTML Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Headings h1-h6 and Their Hierarchy
  2. Paragraphs em strong and b i
  3. br hr blockquote and pre
  4. The span and div Elements
← Back to HTML Academy