Skip to the workspace
Pebellslearn by building
Document Structure  ›  Lesson

head and body

head 12 minInside html sit exactly two children: head holds information about the page that is mostly not displayed, and body holds everything the visitor actually sees.

html / head and body

Explore each scene at your own pace.

01 · The rule

The rule

head and body

Inside html sit exactly two children: head holds information about the page that is mostly not displayed, and body holds everything the visitor actually sees.

Put metadata and visible page content in the appropriate document regions.

Think of a book. The cover, the barcode and the publishing details describe the book; the chapters are the book. An HTML document has the same split, and it is written into its structure as two elements: head and body.

The rule

head is about the page; body is the page.

The html element has exactly two children, always in this order:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Rainy Day Reads</title>
    <link rel="stylesheet" href="styles.css">
  </head>
  <body>
    <h1>Rainy Day Reads</h1>
    <p>Five short books for a wet afternoon.</p>
  </body>
</html>

head holds metadata: information about the document. The character encoding, the title that appears in the browser tab, links to stylesheets, a description for search results and scripts all go here. Almost nothing in head is drawn on the page itself.

body holds the content: headings, paragraphs, images, links, lists, forms. If a visitor can see it, hear it or click it inside the page, it lives in body.

There is exactly one head and one body, and nothing sits between them or after body. Browsers will try to repair a document that breaks this rule, but, as you learned earlier, a repaired tree is a guessed tree.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.