HTML reference

head

The <head> element contains metadata about an HTML document. Most of its contents are not shown in the page body, but they help browsers, search engines, and social services understand and load the page.

What you will learn

  • What belongs inside <head>
  • How metadata differs from visible content
  • How title, meta, link, and script differ

Basic structure

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Page title</title>
  <link rel="stylesheet" href="style.css">
</head>

Common elements

<title>
Sets the document title shown in browser tabs and used in search results.
<meta>
Provides metadata such as character encoding, viewport behavior, and a description.
<link>
Connects the document to an external resource, such as a stylesheet, icon, or alternate language page.
<script>
Loads or embeds JavaScript. Use defer when a script can wait until parsing is complete.

Important distinction

Put content that readers should see in <body>. The <head> describes the document; it is not a hidden place for ordinary page text.

Related pages