Sub topic 1
The four building blocks of a page
Almost every marketing site, blog, shop, and portfolio follows the same layout. A bar at the top identifies the site and offers navigation. A large opening message follows. Below it come the main content sections. A strip at the bottom closes the page. This chapter names those four parts, shows how to find them on a real page, and gives you a first skeleton to build on. Later chapters cover each part in detail.
Prerequisites
This chapter assumes you already know the following:
- Basic HTML tags and attributes, such as
<a href="...">,<img src="..." alt="...">, and how elements nest. - Basic CSS selectors and properties, such as class selectors,
margin,padding, anddisplay. - How to open a page in a browser and use its developer tools, at least to inspect an element and read its tag name.
You do not need to know grid, flexbox, media queries, or accessibility techniques yet. They get their own chapters, and this chapter only previews them.
Learning objectives
After this chapter you should be able to:
- Name the four building blocks and say what each one is for.
- Identify them on an existing page, both visually and in the developer tools.
- Write a page skeleton that marks the blocks with semantic elements.
- Explain why the hero is a part of
mainand not a fifth top-level region.
The four blocks at a glance
A typical page has these parts, from top to bottom:
| Block | Job | Typical HTML element |
|---|---|---|
| Header | Says whose site this is and where to go next | `<header>` with a `<nav>` inside |
| Hero | Gives the first and most important message, with one action | `<section class="hero">` as the first child of `<main>` |
| Content sections | Support the message with details, proof, and options | One or more `<section>` elements inside `<main>` |
| Footer | Closes the page with legal text and secondary links | `<footer>` |
The table lists the hero and content sections as separate blocks, but in the HTML both live inside <main>. The hero is simply the first section. It gets its own name because it has a distinct purpose and usually its own styling.
The diagram shows three top-level regions and four blocks. The header, main, and footer are siblings inside <body>. The hero and content sections are children of main.
Block 1: the header
The header sits at the top and answers two questions: "Where am I?" and "Where can I go?" It usually holds a logo or site name that links to the home page, and a navigation list.
Typical contents:
- A site name or logo, linked to
/. - A primary navigation menu with three to seven links.
- Sometimes a search box or a sign-in link.
Keep the header small. It appears on every page, so anything you add to it competes with the content on every page.
Block 2: the hero
The hero is the first content area a visitor sees below the header. Its job is to state what the page offers in a few seconds. A good hero has:
- One
<h1>that states the main message. - One or two sentences of supporting text.
- One main call to action (CTA), which is a link or button telling the visitor what to do next.
- Optionally, an image that supports the message.
The word "hero" comes from design practice and is not an HTML element. You build it from ordinary elements and mark it with a class.
Block 3: the content sections
Content sections hold everything else the page has to say. On a bakery page, that might be specialties, opening hours, and customer reviews. Each section covers one topic and starts with its own heading, normally an <h2>.
A useful test: if you can give a block a short heading that describes it, it is probably a section. If you cannot, it is probably just a wrapper for layout, and a <div> is the better choice.
Block 4: the footer
The footer closes the page. It holds information that visitors need sometimes but not first: copyright text, a privacy link, contact details, social links, and a repeat of key navigation. Visitors who reach the bottom of a long page often look there for a way forward, so a useful footer is more than decoration.
A first skeleton
The following page marks all four blocks. Read it from top to bottom and match each region to the table above.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Acme Bakery</title>
</head>
<body>
<header>
<a href="/">Acme Bakery</a>
<nav aria-label="Primary">
<ul>
<li><a href="/menu">Menu</a></li>
<li><a href="/about">About</a></li>
<li><a href="/contact">Contact</a></li>
</ul>
</nav>
</header>
<main>
<section class="hero">
<h1>Fresh bread, baked every morning</h1>
<p>Order ahead and pick up warm loaves on your way to work.</p>
<a href="/menu">See the menu</a>
</section>
<section>
<h2>Our specialties</h2>
<p>Sourdough, rye, and seasonal pastries.</p>
</section>
</main>
<footer>
<p>© 2026 Acme Bakery</p>
<a href="/privacy">Privacy</a>
</footer>
</body>
</html>Points worth noticing:
<header>,<main>, and<footer>are direct children of<body>. The header and footer inside<body>are the page's own header and footer.- The hero is a
<section>withclass="hero". The class is a styling hook, and the<section>element gives it meaning as a distinct part of the page. - The hero holds the only
<h1>. The next section starts at<h2>. - There is exactly one
<main>. It holds the content that is unique to this page. - The
langattribute and the viewport<meta>tag are small details that matter. The first helps screen readers pick the right pronunciation, and the second makes the page scale properly on phones.
Without any CSS, this page already reads sensibly in a browser. The browser stacks the blocks in source order, which matches the order you want on a narrow screen.
Finding the blocks on a real page
You can practice on any site you like. Use this routine:
- Open the page and scroll once from top to bottom. Without opening any tools, point to where you think each block begins and ends.
- Open the developer tools and switch to the Elements panel.
- Look for
<header>,<main>, and<footer>as direct children of<body>. - Inside
<main>, find the first section. Check whether it contains the page's<h1>. If it does, that is the hero. - Count the remaining sections and note the heading in each.
Real sites are messier than the skeleton. You may find a <div class="header"> where <header> belongs, or a hero placed in a <div> outside <main>. The visual blocks still exist. The markup just does not label them. Spotting that gap is the first step toward fixing it.
Common mistakes
These errors appear often in first drafts.
- Skipping
<main>. Without it, assistive technology has no way to jump straight to the page's primary content. - Using more than one
<main>. A page has one main content area. Multiple copies confuse landmark navigation. - Putting the hero outside
<main>. The hero is part of the page's main content, so it belongs inside. - Using
<section>for everything. A<section>without a heading is usually a<div>in disguise. Use<div>for pure layout wrappers. - Several
<h1>elements or none. Give each page one<h1>, normally in the hero. The next chapters cover headings in more depth. - Making the hero a CSS-only construct. A hero that exists only as a background image, with its message baked into the picture, has no heading, no text to read aloud, and no text to search.
- Overloading the footer. A footer with fifty links is a sitemap that few people read. Keep it to what visitors really need.
What comes next
This chapter gave you the map. The following chapters walk through it in the order a visitor experiences it:
- Semantic elements and the heading outline.
- The header and its navigation.
- The hero and its image.
- Content sections and the footer.
- Layout with grid and flexbox, and adapting to screen size.
- Accessibility features such as landmarks and skip links.
- Assembling everything into one finished page.
Recap
- A typical page has four blocks: header, hero, content sections, and footer.
- The header,
main, and footer are the top-level regions. The hero and content sections are insidemain. - Semantic elements such as
<header>,<nav>,<main>,<section>, and<footer>label each block so that browsers, search engines, and assistive tools can understand the page. - Use the developer tools to check whether a page's markup matches its visual structure.
Exercise
In the skeleton above, which element contains the hero, which elements are its siblings in the markup, and why is the hero not a fifth top-level region next to the header and footer?
Show answer
The hero is a <section class="hero"> inside <main>. Its sibling is the second <section> (the content section "Our specialties"). It is not a top-level region because it is part of the page's main content. The only top-level regions are <header>, <main>, and <footer>, which are direct children of <body>. The hero is distinguished by its purpose and styling, not by a special element.
Exercise
You inspect a page and find <div id="top">, <div id="banner">, <div id="content">, and <div id="bottom"> as direct children of <body>. Which semantic element would you use to replace each one, and what extra check would you make on the banner?
Show answer
Replace #top with <header>, #content with <main>, and #bottom with <footer>. The #banner is most likely the hero, so make it a <section class="hero"> and move it inside <main> as the first child. Then check that it contains the page's single <h1>, a short supporting text, and one main call to action.
Exercise
Open any site you use often. Name its header, hero, content sections, and footer, then list one way its markup matches the skeleton and one way it differs.
Show answer
Answers vary. A good answer names each block visually, then uses the Elements panel to confirm the tags. For example: "The header is a <header> with a <nav> inside, which matches. The hero is a <div> outside <main>, which differs, because it should be a <section> inside <main>." Any real match and any real difference, supported by what you saw in the developer tools, is correct.