HTML Document Titles and Meta Descriptions
Title versus heading
The title in head names the document, for example in a browser tab. The h1 in body introduces the visible content. They can be similar without having identical wording.
<!doctype html><html lang="en"> <head> <meta charset="utf-8"> <title>Opening hours | City Library</title> </head> <body> <h1>Opening hours</h1> </body></html>The document title includes the site name; the heading does not.
Describe the page
A description is a short, truthful summary in meta name="description". Google may use it for a search snippet or select relevant page text instead. It is not displayed as a paragraph by HTML.
<!doctype html><html lang="en"> <head> <meta charset="utf-8"> <title>Metadata practice</title> <meta name="description" content="Find library opening hours and borrowing information."> </head> <body> <h1>Library information</h1> </body></html>Inspect the content attribute in head. No search snippet is generated locally.
Use meaningful titles on separate pages
A page about membership needs a title specific to membership, not the generic site title used everywhere. Avoid keyword repetition and exaggerated descriptions. Search services can choose a different title link.
<!doctype html><html lang="en"> <head> <meta charset="utf-8"> <title>Membership | City Library</title> <meta name="description" content="Learn how to get a library card."> </head> <body> <h1>Membership</h1> </body></html>The title and summary reflect the visible topic.
Common mistakes and practice
Keep one meaningful title per ordinary page. Do not promise rankings or fixed snippet lengths. Practice writing a different title and description for a contact page.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
HTML Document Titles and Meta Descriptions — Knowledge Check
Apply the metadata concepts taught in this lesson.
Which element names the browser tab?
Where does the description belong?
Must Google display the exact description?
Which title is best for the membership page?
What is h1 for?