You’ve learned <div>, the “box for grouping.” But <div> was a box that carries no meaning, remember? In fact, for a page’s big parts—the header at the top, the menu, the main content, the footer at the bottom—there’s a dedicated box that carries meaning for each. Think of them as the “meaning-added versions” of <div>.
A page is made of four rooms
Viewed broadly, most pages are made up of these four rooms.
| Tag | Role (which room) |
|---|---|
<header> | The top of the page. Place the logo and site name here |
<nav> | The menu. Line up links to other pages |
<main> | The main content. The star content of that page |
<footer> | The bottom of the page. Copyright, contact info, and so on |
Assembled, it makes a framework like this.
<body>
<header>
Shima
<nav>
<a href="#about">About Me</a>
<a href="#likes">Favorites</a>
<a href="#contact">Contact</a>
</nav>
</header>
<main>
<h2>About Me</h2>
<p>I'm Shima, and I love drawing and ramen.</p>
</main>
<footer>
<p>© 2026 Shima</p>
</footer>
</body>Wrapping everything in <div> looks exactly the same. But because each part has a name for its role, this framework is far easier to read, isn’t it?
section and article, for finer divisions
When you want to divide the contents of <main> even further, you can also use <section> (a meaningful chunk) and <article> (a piece that stands complete on its own).
<main>
<section id="likes">
<h2>Favorites</h2>
<ul>
<li>Drawing</li>
<li>Ramen</li>
</ul>
</section>
</main>The way to choose between <section> and <article> comes down to “does it stand complete on its own when cut out?” A single blog post, one news item, one announcement—something you can read on its own is <article>, and “a single section” within a page is <section>. If you’re unsure, <section> is fine. For now, it’s plenty just to know that “the main content, too, can be divided into meaningful chunks.”
When you’re unsure which box to use
Now that we’ve collected a few box tags, let’s sort out how to choose between them. The trick is to work down the list from the top.
- Is there a dedicated tag that fits perfectly?—
<header>for the top of the page,<nav>for a menu,<main>for the main content,<footer>for the bottom - Is it a “meaningful chunk” you could give a heading to?—then
<section>(or<article>if it stands on its own) - None of those, just a box you want to decorate?—the last resort is
<div>
“Think of meaningful tags first, and div dead last.” Just remember this order, and you won’t get lost choosing boxes.
CSSLine things up with FlexboxLining up these four rooms “side by side” and “centering” them—arranging them just as you want is the job of CSS layout, which comes much later in the courseSummary of this lesson
<header>,<nav>,<main>, and<footer>are “meaningful boxes” that split a page by role<main>is one per page. Inside the main content, you can divide further with<section>- Even though the look is the same as div, it’s kind to search engines and screen readers