Lesson 11 of 23

In progress

Course progress

HTML and CSS

The head: titles, descriptions and sharing

Write a title and description people will click, add sharing metadata, and load stylesheets and icons without slowing the page.

The head is invisible on the page and very visible everywhere else: in the browser tab, in search results, in a chat preview, on a phone’s home screen. It is worth ten minutes of care per template.

What you will learn

  • Write a page title and description that work out of context.
  • Add Open Graph tags so shared links look intentional.
  • Load stylesheets, icons and preloads in the right order.

Title and description

HTML
Editable. Runs in your browser.





Press Run to see the output.

The title is the clickable line in search results and the label on a tab. Put the specific topic first and the site name last, separated by a hyphen or a pipe. Around 60 characters is a practical limit before it is truncated.

The description does not affect ranking directly, but it is often the snippet under the title. Write it as a reason to click, in one or two sentences, around 150 characters. Every page should have its own; duplicating one across a site wastes the opportunity.

Neither should be keyword stuffing. They are read by people. Keep the description free of stray quotation marks, which break the attribute, and avoid promising something the page does not deliver.

Sharing metadata

Open Graph tags control the preview when a link is shared on social platforms and in chat apps.

<meta property="og:type" content="article">
<meta property="og:title" content="Python lists: store and slice many values">
<meta property="og:description" content="A beginner guide to Python lists and slicing.">
<meta property="og:url" content="https://tutorials.in/tutorials/python/lists/">
<meta property="og:image" content="https://tutorials.in/img/lists-1200x630.png">
<meta name="twitter:card" content="summary_large_image">

og:url should be the canonical address. og:image should be an absolute URL, roughly 1200 by 630 pixels, with text large enough to read in a small card. A relative image path often fails because the scraper is not on your page.

The canonical link tells search engines which address is the original when the same content is reachable in several ways:

<link rel="canonical" href="https://tutorials.in/tutorials/python/lists/">

Use absolute URLs for canonical and Open Graph. Relative URLs work in a browser and break in the tools that read these tags.

Icons and the browser chrome

A favicon appears in the tab and in bookmarks. Modern browsers accept an SVG icon and fall back to a PNG.

<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<meta name="theme-color" content="#12132a">

theme-color tints the browser interface on some mobile browsers. Keep it consistent with your header colour so the page does not look like two different sites.

Stylesheets, scripts and preloads

<link rel="stylesheet" href="/assets/css/main.css">
<link rel="preload" href="/assets/fonts/inter-400.woff2" as="font" type="font/woff2" crossorigin>
<script src="/assets/js/main.js" defer></script>

Stylesheets in the head block rendering until they load, which is correct: showing unstyled content and then restyling it is worse. Keep the critical stylesheet small.

preload starts a fetch earlier for a resource you know the page needs immediately, such as the body font. Preloading too many things competes with the HTML and makes the page slower. crossorigin is required for fonts even when they are on your own domain.

defer downloads a script without blocking parsing and runs it after the document is parsed, in order. async runs it as soon as it arrives, which is right for independent analytics and wrong for scripts that depend on each other.

Order in the head

Put charset first, then viewport, then the title and description. Encoding must be known before the browser reads any text; viewport must be known before layout.

HTML
Editable. Runs in your browser.





Press Run to see the output.

Using the same title and description on every page, or leaving the title as "Home", makes search results indistinguishable and previews useless. Titles and descriptions belong to the template, driven by the page’s own data, not typed once in a layout file.

Write the head for an article called "CSS Grid in practice". Include charset, viewport, a title under 60 characters, a description under 155, a canonical URL, three Open Graph tags and a favicon link.

Show solution
<head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>CSS Grid in practice: layouts that adapt</title> <meta name="description" content="Build responsive card and page layouts with CSS Grid, from template columns to auto-fit and minmax."> <link rel="canonical" href="https://tutorials.in/tutorials/html-css/css-grid/"> <meta property="og:type" content="article"> <meta property="og:title" content="CSS Grid in practice"> <meta property="og:url" content="https://tutorials.in/tutorials/html-css/css-grid/"> <link rel="icon" href="/favicon.svg" type="image/svg+xml"> </head>

The title is specific and under 60 characters, the description gives a reason to click, and the canonical and Open Graph URLs are absolute.

Recap

  • A specific title and description per page decide how the page appears in search and in tabs.
  • Canonical and Open Graph URLs should be absolute, with a 1200×630 image for sharing.
  • charset first, then viewport, then title; preload sparingly and use defer for scripts.

You have finished the HTML modules. Next, you will start CSS with selectors and the cascade.

Do meta keywords matter?
No. Search engines have ignored them for years, and filling them only tells competitors what you are targeting.
Can I have more than one stylesheet?
Yes, but each is an extra request and another place for conflicts. One file is easier to reason about; split only when a section is genuinely optional.

Full syllabus

Progress is saved in this browser only. No account, no email.

Admin

About the author

Admin

Instructor and technical writer at tutorials.in

Writes beginner lessons for tutorials.in. Each lesson is checked against the language or tool documentation, and examples are run before publishing.

Reviewed by the editorial team before publishing. Last updated November 16, 2026.