0Pricing
HTML Academy · Lesson

Headings h1-h6 and Their Hierarchy

Use heading levels to create meaningful document structure.

Headings h1-h6 and Their Hierarchy is a free HTML Academy lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the HTML Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

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

Frequently asked questions

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

Yes — the full text of “Headings h1-h6 and Their Hierarchy” is free to read here on the web, and the HTML Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the HTML Academy course, upgrade to CoddyKit PRO.

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; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.

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