Unit 2 · HTML: structure and meaning
Why the title tag isn’t the heading
The <title> lives in the head and names the page on the browser tab, in bookmarks and in search results. It never shows inside the page. The big heading people see is the <h1>, inside the body.
The mix-up
What people often think
“The title is the big heading you see on the page.”
What the tutor says
The title lives in the head. It is the text on the browser tab, not on the page. The heading people see on the page is the h1, inside the body.
Look at the tab at the top of your browser. What text is there right now?
How it works
Look at the tab at the top of your browser: that text is the page’s title. The heading in the page itself is a separate element. They often say similar things, but they do different jobs and live in different places.
Search engines usually show the title as the blue link in results, so it should be short and specific. The h1 tells someone already on the page what it is about. Give every page one of each.
Side by side
<body>
<title>Corner Bakery menu</title>
<p>Fresh bread daily.</p>
</body><head>
<title>Menu · Corner Bakery</title>
</head>
<body>
<h1>Our menu</h1>
<p>Fresh bread daily.</p>
</body>Close cousins of this mix-up
The tutor watches for these in the same lesson.
“The title goes where the visible heading goes.”
Move the title into the head. The body is only for what shows on the page.
Practise it with a tutor watching
Build the DOM tree
Read and build the tree of nested elements behind any web page.
Free with an account. The first two units need no account.