Swipe
SwipeSwipe
Swipe Apps

Paths

Motivation

Information

The Shape of an HTML Document · Lesson 6 of 18

The html, head, and body Elements

A free lesson from Swipe Coding · HTML, level 1 · updated October 2026

By the Swipe team, founded by Colin · how we make lessons

Right after the doctype, every HTML document has one <html> element that wraps everything else, and inside it exactly two direct children: <head> and <body>.

<!DOCTYPE html>
<html>
  <head>
    <!-- page info goes here -->
  </head>
  <body>
    <!-- visible content goes here -->
  </body>
</html>
The complete skeleton every HTML page starts from.
🤖
Head is for the browser and search engines. Body is for the person looking at the screen. 👀

The <head> holds information about the page that is not directly displayed on the screen — things like the page title, character encoding, and links to other files. The <body> holds everything a visitor actually sees: text, images, buttons, links, all of it.

A common beginner mistake is putting visible content in the <head> by accident, or forgetting the <body> tag entirely. Browsers are forgiving enough to often still show something, but relying on that guesswork is a habit worth avoiding from the start.

Quick check

What are the two direct children of the <html> element?

Fill in the blank

The ____ element holds everything a visitor actually sees on the page — text, images, buttons, and links.

True or false

The <head> element is where visible page content like paragraphs and images belongs.

Keep your streak going in Swipe Coding

Swipe through every level of HTML on your iPhone — with XP, stars, streaks, a personal advisor and the full track beyond these free levels.

Get the Swipe apps →