TetSharing
HTML tutorial · 12 chapters
  1. Get started
  2. Elements and attributes
  3. Headings and paragraphs
  4. Text formatting
  5. Links
  6. Images
  7. Lists
  8. Tables
  9. Forms
  10. Input types and controls
  11. Semantic layout
  12. Head and metadata

Final HTML quiz

Chapter 12 of 12 · By Ethan Cole · Updated November 21, 2026

HTML head Element: title, meta Tags and Viewport

The <head> is invisible on the page, but it decides how the page is read, displayed on phones, labeled in browser tabs, shown in search results and previewed when shared. A small set of tags covers almost every site.

The essentials

  • <meta charset="utf-8"> declares the character encoding. Put it first in the head, within the first 1024 bytes of the file, so the browser decodes every character correctly from the start.
  • <meta name="viewport" content="width=device-width, initial-scale=1"> tells mobile browsers to use the device's real width instead of pretending to be a desktop screen and shrinking the page. Without it, responsive CSS does not work on phones.
  • <title> names the document. It appears in the browser tab, in bookmarks and, usually, as the clickable headline in search results. Make it specific and unique for every page, with the most important words first. Scripts can read it as document.title, as the example does.
HTML · editable

Expected page text

Paper Cranes
Title: Paper Cranes by Aiko Tanaka | Example Books

For search engines

  • <meta name="description" content="..."> is a short summary. Search engines may show it under the title in results, so write it for people, in one or two sentences.
  • <link rel="canonical" href="..."> names the preferred URL when the same content is reachable at several addresses, for example with and without tracking parameters.
  • <meta name="robots" content="noindex"> asks search engines not to index a page, which is typical for error pages and internal search results.

For browsers and sharing

  • <link rel="icon" href="/favicon.svg"> sets the tab icon. The example uses an empty data URL so the preview does not request a file.
  • Open Graph tags such as <meta property="og:title"> and og:image control the preview card when a link is shared on social networks and chat apps.
  • <link rel="stylesheet" href="..."> loads CSS, and <script src="..." defer> loads JavaScript without blocking the page from rendering.

Order and size

Put charset first, then the viewport and title. Keep the head lean: every stylesheet and synchronous script there delays the first paint, which directly affects how fast the page feels and how it scores on Core Web Vitals.

Common mistakes

  • Reusing the same title on every page of a site.
  • Leaving out the viewport tag, so the page is tiny and zoomed out on phones.
  • Placing visible elements such as headings inside <head>; browsers move them into the body.

Summary

  • Start the head with meta charset, the viewport tag and a unique title.
  • Add a description and, where needed, a canonical link for search engines.
  • Icons, Open Graph tags, stylesheets and deferred scripts complete the head.

Quiz: Head and metadata

1. What does the viewport meta tag do?

Without it, phones render a desktop-width page and shrink it.

2. Where is the <title> text shown?

The title labels the document outside the page content.

3. What is <link rel="canonical"> for?

Canonical links tell search engines which URL to treat as the original.

Official docs

Written under the pen name Ethan Cole with AI-assisted drafting. Every code example on this page is executed by our test suite before publishing. Found a mistake? Tell us.