Sub topic 1
What the Title and Headings Do
A page's <title> element and its heading tags are two of the simplest parts of HTML. They also carry a lot of weight. Search engines, browsers, screen readers and human readers all use them to answer the same question: what is this page about? This chapter explains what each element does, who reads it, and how the two fit together. Later chapters cover writing them well.
Prerequisites
This chapter assumes you have the following:
- Basic HTML structure: you know what
<head>and<body>are and can read a small HTML document. - Familiarity with a search engine results page (SERP): you have seen the blue link, the URL and the snippet under it.
- A basic idea of what a keyword or search query is: the words a person types into a search box.
You do not need to know how to choose a keyword or measure rankings yet. Those topics come later in the tutorial.
Two elements, different jobs
The <title> element lives in the <head>. It is metadata about the document and is not part of the visible page body. Headings (<h1> to <h6>) live in the <body> and are part of the content the reader sees.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>How to Repot a Snake Plant: Step-by-Step Guide</title>
<meta name="description" content="Learn when and how to repot a snake plant, which pot and soil to use, and how to avoid root damage.">
</head>
<body>
<h1>How to Repot a Snake Plant</h1>
<h2>When to repot</h2>
<h2>What you need</h2>
<h3>Choosing a pot</h3>
<h3>Choosing soil</h3>
<h2>Step-by-step repotting</h2>
<h2>Aftercare</h2>
</body>
</html>Both the title and the <h1> describe the same page, but they are read in different places. The following table compares them.
| Property | `<title>` | `<h1>` | `<h2>` to `<h6>` |
|---|---|---|---|
| Location | `<head>` | `<body>` | `<body>` |
| Visible on the page | No | Yes | Yes |
| Shown in browser tab | Yes | No | No |
| Often shown as the SERP link text | Yes | Rarely | No |
| Typical count per page | Exactly one | One | As many as the content needs |
| Main job | Label the whole document | Name the main topic on the page | Divide the topic into sections |
Who reads the title
The title is used in at least four places.
- Search results. Search engines usually show the title as the clickable headline of a result. It is often the first thing a searcher reads about your page.
- Browser tabs and window lists. Users with many tabs open rely on the title to find your page again.
- Bookmarks and history. The browser saves the title as the default name of a bookmark.
- Sharing. Many apps, such as chat tools and social networks, use the title as the link preview text when no other preview data exists.
Because the title appears out of context, it must make sense on its own. A reader who sees only the title should be able to tell what the page covers and whether it matches their need.
A title also helps search engines decide what the page is about. It is one signal among many. A good title does not guarantee a high ranking, and a page with a weaker title can still rank if its content fits the query well. What a good title does is state the topic clearly, so that both the search engine and the searcher can judge relevance quickly.
Who reads the headings
Headings serve readers and software that are already on your page.
- Human readers scan. Most people skim a page before reading it. Headings let them find the section they came for. On a how-to page, a reader may jump straight to "Aftercare".
- Search engines read structure. Headings show how the content is organised and which phrases name each part. A section headed "Choosing soil" tells a crawler that the text beneath it is about soil choice.
- Assistive technology uses them for navigation. Screen readers can list all headings on a page and let the user jump between them. A later chapter in this tutorial covers this in more detail.
- Other software reuses them. Browser extensions, reader modes and generated tables of contents often build their output from headings.
A heading's level carries meaning. An <h2> says "this is a main section of the page". An <h3> beneath it says "this is a part of that section". The levels describe the outline of the content, not font size. Use CSS to control appearance and choose the heading level only by where the section sits in the outline.
How the pieces fit together
A single page has one subject, and each element describes it at a different scale. The title names the whole document for people who have not opened it yet. The <h1> names it for people who are now reading it. The lower headings break it into parts.
The diagram shows why the two must agree. A searcher clicks a result because of its title. If the <h1> then describes a different topic, the searcher may feel misled and leave. The title and <h1> do not need identical wording, but they must clearly describe the same subject.
Title and h1 are related but not the same text
A common beginner mistake is to treat them as one element that must be copied. They have different constraints.
- The title appears among other results, so it often includes extra context, such as the type of content ("Step-by-Step Guide") or a site name.
- The
<h1>appears on the page, below the site header, where context is already clear. It can be shorter and more direct.
In the example above, the title is "How to Repot a Snake Plant: Step-by-Step Guide" and the <h1> is "How to Repot a Snake Plant". They share the core phrase and differ in the extras. That is a healthy pattern.
Copying the same text into both is not an error. Many pages do it and work fine. The point is that you may choose the wording for each place on purpose.
What a weak version looks like
The next snippet shows a weak page. It is the "before" version that later chapters in this tutorial will improve.
<!-- Weak: repeated keyword, skipped level, vague headings -->
<title>Snake plant | snake plant repotting | repot snake plant | best snake plant</title>
<h1>Snake Plant</h1>
<h4>Snake plant repotting tips snake plant</h4>
<h2>More</h2>Judged only by the roles described in this chapter, it has these problems:
- The title repeats the phrase. It reads as a list of search terms, not as a description a person would click. As a label, it does not tell the reader what kind of page this is.
- The
<h1>is vague. "Snake Plant" names a subject, not what the page does for the reader. It could be a care guide, a shop page or a botany summary. - The levels jump. The page goes from
<h1>straight to<h4>, so the outline has a gap. A reader or a screen reader user sees a structure that does not add up. - A heading says nothing. "More" gives no hint about the section's content, so it fails as a scanning aid and as a navigation label.
- The
<h4>repeats the keyword. It reads like a phrase written for a machine and not for a person.
You do not need to fix these yet. Notice that each fault comes from forgetting who reads the element.
Common misunderstandings
"The title is the same as the page's visible headline." It is not. The title is in <head> and never appears in the page body. A user sees it only in the tab, in search results, or in a bookmark.
"Headings are for making text bigger." Headings describe structure. If you want large text that is not a section title, use CSS on a paragraph or a <div>. Using a heading tag only for its look pollutes the outline.
"More headings means better SEO." Headings are useful when they mark real sections. Adding headings to fill space gives search engines and screen reader users noise to wade through.
"A great title will rank a thin page." The title helps with clarity and relevance. It does not replace useful content. If the page does not deliver what the title promises, readers leave and the page does not earn the visits.
"Search engines always show my title." They often do, but not always. Search engines can replace the title in results with text they judge to be a better description. A later chapter covers when that happens and what to do about it.
A quick way to see your own page's outline
You can view how a page is structured without special tools. Open the page, then open the browser's developer console and run this script. It prints the title and a list of headings with their levels.
console.log("Title:", document.title);
const headings = document.querySelectorAll("h1, h2, h3, h4, h5, h6");
headings.forEach((el) => {
const level = Number(el.tagName.slice(1));
const indent = " ".repeat(level - 1);
console.log(`${indent}h${level}: ${el.textContent.trim()}`);
});On the good example above, the output looks like this:
Title: How to Repot a Snake Plant: Step-by-Step Guide
h1: How to Repot a Snake Plant
h2: When to repot
h2: What you need
h3: Choosing a pot
h3: Choosing soil
h2: Step-by-step repotting
h2: AftercareThis printed outline is close to what a screen reader user or a crawler gets from your headings. If it reads like a sensible table of contents, the structure is doing its job. If it has gaps, repeated labels or meaningless entries such as "More", you have found something to fix.
Summary of the roles
- The
<title>labels the whole document. It appears in search results, tabs and bookmarks, so it must make sense out of context. - The
<h1>names the main topic once the reader is on the page. - The
<h2>to<h6>headings divide the topic into a hierarchy that readers scan and tools navigate. - All of them describe the same subject. Disagreement between them confuses readers and weakens the signal to search engines.
- Appearance belongs in CSS. Headings express structure only.
The next chapters build on these roles. You will first look at search intent, so that you know what a searcher wants, and then choose a keyword that fits it.
Exercise
A page has the title "Best Running Shoes 2026 | Acme Store" and an h1 that says "Welcome". Using what you know about the roles of each element, name two problems, and say what the h1 should do instead.
Show answer
First, the h1 "Welcome" does not name the page's main topic. A visitor who arrives from the search result for running shoes sees a headline that says nothing about shoes, so the title and h1 do not clearly describe the same subject. Second, "Welcome" is a poor label for navigation and for search engines reading the page structure, because it carries no information about the content. The h1 should state the page's main topic, for example "Best Running Shoes for 2026", so that it agrees with the title while possibly being shorter and without the site name.
Exercise
A developer wants a short, bold line of text above a product's price, so they wrap it in an h4 even though the page has only an h1 above it. What is wrong with this, and what should they do instead?
Show answer
Headings describe the outline of the content and not its appearance. The h4 skips levels, so the outline has a gap that confuses screen reader users and crawlers, and the line is probably not a section title anyway. The developer should use a normal element such as a p or a span and style it with CSS to be bold and short. If the line really does start a new section, they should use the next heading level, h2, and let CSS control the size.
Exercise
Where is the title element visible to a user, and where is it not?
Show answer
The title is visible in the browser tab, in bookmarks and history, and usually as the clickable headline in search results. It is not visible in the page body, because it is in the head. The text a user sees at the top of the page itself comes from the h1 or other body elements.