Capstone: A Complete Page Skeleton
A complete HTML page combines the doctype, a root html with lang, a head with encoding, viewport, title and description, and a body holding the visible content.
Assemble a complete document and verify that each part has a clear responsibility.
You now know every piece of the frame that surrounds a web page. In this capstone you assemble them into one skeleton, the starting file you will reuse for every page you build. It is short enough to type from memory, and that is the goal.
The rule
Doctype, root, head for the machine, body for the human.
Here is the full skeleton, filled in for a small community garden page:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Green Lane Community Garden</title>
<meta name="description" content="Plots, workdays and seed swaps at the Green Lane Community Garden.">
</head>
<body>
<h1>Green Lane Community Garden</h1>
<p>We grow vegetables, herbs and flowers on shared plots. Everyone is welcome.</p>
<p>Next workday: Saturday morning. Bring gloves.</p>
</body>
</html>Walk it from top to bottom and every line has a reason:
- The doctype puts the browser in standards mode.
- The root
htmlwraps everything and declares the language. - The head gives the browser the encoding and viewport, and gives people the title and description.
- The body holds what the visitor actually reads, starting with one
h1that matches the page's purpose.
The indentation is for you, not the browser: whitespace collapses, so nesting children two spaces deeper simply makes the tree easy to see.