← Web basics: HTML, CSS and JavaScript
The shape of an HTML page
doctype, html, head and body: the frame every page sits in.
Every HTML page has the same frame. The first line, <!DOCTYPE html>, tells the browser "this is modern HTML". Everything else sits inside <html>. Inside that are two parts: <head> holds information about the page that is not drawn on it, like the title shown on the browser tab, and <body> holds everything you actually see. Knowing this frame helps you know where each new piece goes.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Ama's Recipes</title>
</head>
<body>
<h1>Ama's Recipes</h1>
<p>Easy meals for busy weeks.</p>
</body>
</html>The tab shows "Ama's Recipes" because of <title>. The heading and paragraph appear on the page because they are inside <body>. The meta charset line lets the page show any language's letters and emoji correctly.
lang="en" tells browsers and screen readers the page is in English, so the words are pronounced correctly. Use "es" for Spanish, "hi" for Hindi, and so on.
Indenting (pushing lines to the right) is not required, but it makes it easy to see what is inside what.