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 <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.
What are the two direct children of the <html> element?
The ____ element holds everything a visitor actually sees on the page — text, images, buttons, and links.
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 →