CHAPTER 08 · HTML

Headings: organise a page so readers can find their way

A heading tells readers what the following content is about. In this chapter, you will choose heading levels by the organisation of the information, not by guessing which font size looks best. You will practise both a realistic page outline and the six available levels.

Download example files (ZIP)

What you will learn

  • Use h1 through h6 and understand their levels.
  • Build a main topic, sections and subsections.
  • Distinguish a document title, a heading and a bold sentence.
  • Recognise the value of headings for readers and assistive tools.
  • Check an outline before adding visual design.

Think of a course notebook

A notebook may have a main subject, units within that subject and smaller topics within a unit. Headings give a web page a similar map. A reader can skim them before deciding which paragraphs to read closely.

The map is called a hierarchy: an arrangement of broader and narrower topics. You can remember it as levels. HTML provides six heading levels, h1 to h6. The number is the level, not an instruction that the text must be a fixed number of pixels tall.

ElementRole in a simple page
h1Main page heading
h2A major section within that topic
h3A subsection within an h2 section
h4A further subdivision within an h3 section
h5A further subdivision within an h4 section
h6A further subdivision within an h5 section

An h6 can describe important information within its own small topic. A deeper level does not mean its words do not matter; it describes where that topic belongs in the outline.

Write the heading syntax

HTML fragment — part of a document
<h1>Campus learning fair</h1>
<h2>Morning sessions</h2>
<h3>Writing your first page</h3>

Use an opening and matching closing tag around meaningful text. There is no generic <h> element that automatically chooses a level, and <h7> is not a seventh standard heading level. Keep the heading inside body, not head.

A heading should name its section. Details such as the room number, time and instructions usually belong in the paragraphs that follow it. A long paragraph wrapped entirely in h2 is not a useful heading just because it becomes visually prominent.

Choose the level from the content

Imagine a fair with morning and afternoon sessions. Both are major sections, so both use h2. A web-page workshop and a file-management workshop within the morning section use h3. The afternoon section returns to h2 because it is another main section.

Example fragment — use inside a complete program
h1 Campus learning fair
  h2 Morning sessions
    h3 First web page
    h3 Organising practice files
  h2 Afternoon sessions

This is an outline diagram, not literal HTML. Returning from h3 to h2 is normal when starting another main section. Avoid jumping from h1 straight to h4 merely to obtain a smaller appearance.

Let the topics choose the levels
  1. 1h1: one page topic
  2. 2h2: a major section
  3. 3h3: a real subsection
  4. 4Another h2: a parallel major section

A heading level describes the content structure. It does not promise a fixed font size or search ranking.

Complete example: a clear event outline

learning-fair.html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Campus Learning Fair Sessions</title>
</head>
<body>
  <h1>Campus learning fair</h1>
  <p>Choose a session that matches your current practice.</p>
  <h2>Morning sessions</h2>
  <h3>First web page</h3>
  <p>Write and check a small HTML notice.</p>
  <h3>Organising practice files</h3>
  <p>Keep each task in a clearly named folder.</p>
  <h2>Afternoon sessions</h2>
  <p>Explain your page to a partner and compare your results.</p>
</body>
</html>
Browser previewDocument title: Campus Learning Fair Sessions

This preview shows the example in a browser. Save the complete code in local files to test links between pages and downloads. Same-page section links work here.

Read only the headings first. They should explain the structure even without the paragraphs. Then read the supporting text and check whether it belongs under the heading immediately before it.

Notice that h2 is used more than once. A heading level can repeat for sibling topics. You do not need to increase the number for every new heading on a page.

A second example: recognise all six levels

This example demonstrates available levels. Most beginner pages do not need to go this deep. Do not add empty or unnecessary topics just to use every heading element.

heading-levels.html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Six Heading Levels</title>
</head>
<body>
  <h1>Learning handbook</h1>
  <h2>Web development</h2>
  <h3>HTML</h3>
  <h4>Text content</h4>
  <h5>Heading practice</h5>
  <h6>Final outline check</h6>
  <p>Each deeper heading belongs under the topic above it.</p>
</body>
</html>
Browser previewDocument title: Six Heading Levels

This preview shows the example in a browser. Save the complete code in local files to test links between pages and downloads. Same-page section links work here.

Browsers normally give heading levels different starting styles. Exact appearance can vary, and CSS can change it. A large h3 is still an h3; changing its font size does not change the level expressed by the markup.

Title, heading and bold text are different

The title element in head names the document for places such as a normal browser tab. An h1 names the main topic in the body. The two can use related wording but do not automatically replace one another.

Bold appearance alone does not create a heading. For example, <p><strong>Morning sessions</strong></p> is a paragraph with important text, not an h2. If the text introduces a section, use the appropriate heading element.

The reverse is also true: a heading should not be used merely to make a label large. Use HTML for its role and CSS for the desired appearance. We will learn CSS sizing later.

How headings help different readers

Some readers scan the page visually. Some use assistive software that can list headings or move between them. A clear sequence gives both groups a way to understand and navigate the document.

Do not promise that every tool will read a heading in the same voice or behave identically. The important part you control is the document's meaningful structure and labels.

Useful headings also help software interpret the topic organisation. They are not a guarantee of a high search ranking. Repeating keywords or filling headings with unrelated phrases makes the page less useful to people.

One clear main heading as a beginner convention

For our ordinary standalone pages, use one clear h1 describing the main topic, then h2 and deeper headings where needed. This keeps the outline easy to follow.

That is our authoring convention, not a claim that a second h1 automatically prevents HTML from being parsed. More complex documents have additional considerations, but a new learner benefits from a clear and consistent starting pattern.

Do not assume that putting an h1 inside a section automatically changes it into an h2 for all users and tools. Use explicit levels that describe the intended outline. We will discuss section elements later.

Problem and solution: all headings use h3

Problem: a student chooses h3 for the page title and every section because that default size looks comfortable.

Solution: first write an outline using plain text. Identify the one page topic, its main sections and any subsections. Then use h1, h2 and h3 accordingly. Use CSS later if you want a different visual size.

Test the repair by reading only the headings aloud. Can someone explain which sections are parallel and which are inside others? If not, reconsider the grouping before changing colours.

Common mistakes and useful tips

  • Choosing a level only by font size: level describes organisation.
  • Writing <h> or <h7>: use the six standard heading levels.
  • Increasing the number for every heading: sibling sections can repeat the same level.
  • Skipping levels to obtain a smaller appearance: use a sensible sequence and adjust appearance with CSS.
  • Using a bold paragraph instead of a real section heading: visual similarity does not supply heading semantics.
  • Adding headings without useful text beneath them: each should introduce a real topic.
  • Treating one-h1 guidance as a universal parsing rule: distinguish an authoring recommendation from what browsers can parse.

Practice questions

  1. Which level would you normally use for the main heading of our simple standalone pages?
  2. A page has two main sections, Getting ready and Practice tasks. Should the second automatically become h3?
  3. Why is h1 followed immediately by h4 usually a poor choice when the goal is only a smaller font?
  4. Is <p><strong>Practice tasks</strong></p> the same as an h2?
  5. Read the learning-fair example and list the two h3 subsection names.
  6. Write an outline for a college-club page with a main heading, two main sections and two subsections within the first section. Then turn it into a complete HTML file.
Check your practice answers
  1. H1, with a meaningful title for the page's main topic.
  2. No. Both are parallel main sections, so h2 is appropriate for both.
  3. The level jump gives a confusing content hierarchy. Use the correct level and change font size through CSS when needed.
  4. No. It is an important phrase inside a paragraph, not a heading element.
  5. First web page and Organising practice files.
  6. For example, use h1 for the club, h2 for Activities and Joining, and h3 for Workshops and Study circles within Activities. Add meaningful supporting paragraphs rather than headings alone.

Interview questions

What is the purpose of heading levels?

They express the organisation of topics and subtopics. A browser may give them different default styles, but their meaning is not simply a font-size choice.

Why are real heading elements useful for accessibility?

Assistive tools can use them to expose a document outline or help users navigate. Clear labels and a sensible sequence make that structure useful.

Can the same heading level appear several times?

Yes. Parallel topics can use the same level, such as two h2 sections under one h1. You do not count upward for every heading.

Does changing an h3 to a large font make it an h1?

No. CSS changes the appearance, not the HTML element's level. Choose the element that expresses the intended structure.

Quick revision

  • HTML provides h1 through h6.
  • Choose levels from the content hierarchy.
  • Repeat levels for sibling topics and move deeper for real subdivisions.
  • Title, headings and important paragraph text serve different roles.
  • A clear outline helps people and tools navigate.
  • Use CSS later for appearance; do not misuse heading levels for sizing.