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 asdocument.title, as the example does.
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">andog:imagecontrol 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 uniquetitle. - 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