On this page11 sections
Lecture 022: The Head: Title, Meta & Favicon
| Category | 4: Page Structure |
| Lecture | 022 of 048 |
| Estimated video length | 12 min |
| Target | HTML5 · any modern browser |
| Level | Beginner |
Visitors never see the
<head>directly, but it decides a lot: the tab title, how the page looks on a phone, what Google shows in its results, and the little icon on the tab. This lecture fills it in properly.
Learning Objectives
- Write a good
<title>and meta description - Add the viewport meta tag so pages work on phones
- Link a favicon and a CSS file
- Put together a complete, ready-to-use page template
1. The Title
The <title> appears on the browser tab, in bookmarks, and as the blue link in search results.
<title>Chicken Karahi Recipe - City Kitchen</title>Put the most specific words first, and keep it under about 60 characters.
2. Meta Tags
<meta> tags hold information about the page. Three matter on almost every page:
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="A quick chicken karahi recipe ready in 30 minutes, with step-by-step photos.">| Tag | Why |
|---|---|
charset | Shows every language and emoji correctly |
viewport | Makes the page fit phone screens instead of showing a tiny desktop page |
description | The grey summary text search engines often show under your title |
Example: try it with and without the viewport line on a phone. Without it, the text looks tiny:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Mobile-friendly page</title>
</head>
<body>
<h1>Readable on any phone</h1>
<p>The viewport tag makes this text a comfortable size on small screens.</p>
</body>
</html>3. The Favicon
The favicon is the small icon on the browser tab.
<link rel="icon" href="/favicon.svg" type="image/svg+xml">An SVG stays sharp at every size. A 32×32 PNG also works.
4. Linking CSS (and a Peek at JavaScript)
<link> loads a stylesheet. <script> loads JavaScript; add defer so it runs after the
page has loaded.
<link rel="stylesheet" href="styles.css">
<script src="app.js" defer></script>You'll write styles.css in the CSS course.
5. Sharing Previews
When someone shares your link on WhatsApp or Facebook, these tags decide the preview card:
<meta property="og:title" content="Chicken Karahi in 30 Minutes">
<meta property="og:description" content="Simple steps, big flavour.">
<meta property="og:image" content="https://example.com/images/karahi.jpg">Code Examples
Example 1: A Complete Page Template
Save this as your starting point for every new page.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Page title - Site name</title>
<meta name="description" content="One or two sentences describing this page.">
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
<h1>Site name</h1>
<nav><a href="/">Home</a> · <a href="/about.html">About</a></nav>
</header>
<main>
<h2>Page heading</h2>
<p>Your content goes here.</p>
</main>
<footer>
<p>© 2026 Site name</p>
</footer>
</body>
</html>Common Beginner Mistakes
1. The same title on every page. Each page needs its own title, or search results all look alike.
2. Forgetting the viewport tag. The page then looks like a shrunken desktop site on phones.
3. Visible content in <head>. Headings and paragraphs belong in <body>.
4. Very long descriptions. Search engines cut them off at around 155 characters.
Practice Questions
- Where does the text of
<title>appear? Name two places. - Which meta tag makes a page display properly on phones?
- What does the meta description affect?
- Write the tag that links
styles.css. - What is a favicon?
- Which
<head>tags control the preview card when a link is shared on social media?
Practice Answers
- Any two of: the browser tab, bookmarks, search results.
<meta name="viewport" content="width=device-width, initial-scale=1">- The summary that search engines often show under the page title.
<link rel="stylesheet" href="styles.css">- The small icon shown on the browser tab and in bookmarks.
- The Open Graph tags:
og:title,og:descriptionandog:image.
Key Takeaways
- Every page needs
charset,viewport, a unique<title>and a meta description. <link rel="icon">adds the favicon;<link rel="stylesheet">loads CSS.- Open Graph tags control link previews on social apps.
- You now have a complete page template to start every new page from.