Encodera

Thanks for reading!

Donate to the site — we work hard for you.

HTML & CSS reference

<head>

The service part of the page: encoding, tab title, linked styles and scripts.

Syntax

<head>…</head>

Examples

Typical content of <head>:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>The Bean coffee shop</title>
    <style>
      body { color: brown; }
    </style>
  </head>
  <body>
    <p>Only body is shown; head holds settings.</p>
  </body>
</html>

Notes

Nothing inside <head> is shown on the page. Only service tags belong here: <meta>, <title>, <link>, <style>, <script>, <base>. If you put a visible element like <p> there, the browser moves it to <body> anyway.

See also

  • <html> — The root element of the page: `<head>` and `<body>` live inside it.
  • <title> — The page title: the text on the browser tab and in search results.
  • <meta> — Page metadata: encoding, phone settings, a description for search engines.
  • <link> — Links an external resource to the page: a stylesheet, the site icon, a font.
  • <body> — The visible part of the page: everything the user sees.

Related recipes

In the tutorial

  • Document structure — The skeleton of an HTML page — doctype, html, head and body, the encoding, the tab title, viewport and your first index.html file.

Thanks for reading!

Donate to the site — we work hard for you.