Document structure and the outline

A page is not a flat pile of elements. Read one from top to bottom and it should hold together: a title, then the sections beneath it, each with its own heading, in an order that makes sense to move through. That shape is the page's outline, and it comes from two things working together. The headings name each part, and the landmark regions from the Semantic HTML chapter, <header>, <nav>, <main>, <aside>, and <footer>, group those parts into areas. This chapter is about how the two combine into a whole page.
How headings and landmarks form an outline
A web page reads from top to bottom, the same way you read a page in a book. Whoever visits starts at the top and works down, so the order your content sits in is the order visitors read it. Put things in the order someone would actually want to meet them.
Headings are what give that order a shape. A heading is a short label for the part that follows it, written with tags from <h1> down to <h6>. The <h1> is the title of the whole page. Each <h2> names a main section under it, and an <h3> names a smaller part inside an <h2>. Stack them up and you get the page's outline: a table of contents that mirrors the order of the page.
<h1>Sourdough for beginners</h1>
<h2>What you need</h2>
<h3>Ingredients</h3>
<h3>Equipment</h3>
<h2>Making the starter</h2>Read the headings on their own and you already know what the page is about and how it is organised, before reading a single paragraph.
<h1> down to <h6>, are the skeleton: the <h1> is the page title, and everything nests under it. Read the headings on their own and you should already know how the page is laid out. One main, and correct heading order
Two habits keep an outline clean. First, give the page a single <h1>. It is the title of the page, and a page has one title, the way a book has one name on the cover. Everything else is <h2> and below.
Second, do not jump levels. After an <h2>, the next step down is <h3>, not <h5>. Skipping a level leaves a gap in the outline, like a contents page that lists chapter 1 and then chapter 4. Move one level at a time, down and back up:
<h1>Weeknight dinners</h1>
<h2>Pasta</h2>
<h3>Tomato and basil</h3>
<h3>Garlic butter</h3>
<h2>Salads</h2>
<h3>Greek</h3>The content those headings sit in usually lives in one <main> region. <main> marks the primary content of the page, the part that is unique to this page and not the shared header, navigation, or footer. There is one <main>, the same as there is one <h1>.
<h1> per page, because a page has one title. Step heading levels down one at a time, <h2> then <h3>, no jumping to <h5>. And the main content of the page goes in one <main>. If a heading looks the wrong size, that is a job for CSS, not a reason to switch levels. Grouping and ordering content
Related content reads better when it is grouped. Two elements exist for this. A <section> is a themed chunk of a page that has its own heading, like the "Ingredients" part of a recipe. An <article> is a piece that stands on its own and would still make sense if you lifted it out, like a single blog post or a customer review.
<article>
<h2>Slow-rise focaccia</h2>
<p>A loaf that needs almost no kneading.</p>
</article>Order matters as much as grouping. Because the page reads top to bottom, put the most important content near the top, and arrange the rest in the order a reader would want it. A recipe lists what you need before the steps, because that is the order you would follow it.
<section> for a themed part that has a heading, and <article> for a piece that stands on its own, like a single post. Then mind the order: the page reads top to bottom, so the important things go near the top. Write it in the order someone would actually want to read it. Common structural mistakes
A few structural mistakes show up again and again, and each has a clean fix.
- Using a heading tag to make text big. Reaching for
<h3>because it renders at the size you want breaks the outline. Pick the level by meaning, and set the size in CSS. - Skipping heading levels. Jumping from
<h2>to<h4>leaves a hole in the outline. Go down one level at a time. - More than one
<h1>. A page has one title. Extra<h1>tags muddle the table of contents. - No headings at all. A long run of paragraphs with nothing to break it up is hard to scan. Add headings so a reader can find their way.
Fix these and the page reads clearly for everyone, whether they are scanning with their eyes or listening to it read aloud. The Accessibility chapter goes further on making a page work for every visitor.
<h1>, and do not leave a long page with no headings at all. Each one muddles the outline. Pick heading levels by meaning and let CSS handle the sizes. 
