Lesson 4 of 32
Your first page
You've seen fragments of HTML. Now let's build a complete, proper web page — the real structure every website starts from. This is the boilerplate you'll begin every page with, and it's worth understanding each line.
The full skeleton
Here's a complete HTML document. Run it, then we'll walk through each part:
Every real page has this shape. Line by line:
<!DOCTYPE html>— tells the browser "this is modern HTML." Always the first line.<html>— the root element that wraps the entire page. Everything lives inside it.<head>— information about the page that isn't shown in the main content: the title, links to stylesheets, metadata. (More on this later.)<title>— the page's title, shown in the browser tab (not on the page itself).<body>— everything the visitor actually sees: headings, text, images, links. This is where most of your work goes.
head vs body — the key split
The most important idea here: <head> is invisible information; <body> is visible content. The title in the head shows in the tab; the heading in the body shows on the page. Beginners sometimes put visible content in the head (where it won't show) — visible things go in the body.
Indentation keeps it readable
Notice how nested elements are indented. HTML doesn't require indentation (the browser ignores the extra spaces), but indenting nested elements makes the structure obvious to humans. As pages grow, this readability is essential. Get in the habit now.
The mistake beginners make
Putting content in the wrong place — visible text in <head> (won't show), or forgetting to nest everything inside <html>, <head>, and <body> correctly. The nesting order is always: html wraps head and body; body holds your visible content.
Your turn
Your turn
- Build a complete page with doctype, html, head, title, and body.
- Change the title and watch the browser tab (in the result) update.
- Move the h1 into the head instead of the body and see that it disappears — then move it back.
Key points
- Every page starts with , then wrapping and .
- = invisible info (title, metadata); = the visible content.
shows in the browser tab, not on the page. - Indent nested elements for readability — the browser ignores it, but humans need it.
Q&A · 0
Enrol to ask questions and join the discussion.
No questions yet — be the first to ask.