IntermediateLesson 16 of 307 min read

Page layout with HTML: building a complete homepage structure

Turn a design into a full page: plan the regions, build the semantic skeleton, keep headings in order and test the result.

In this lesson you will

  • Plan a page by naming its regions
  • Build a full homepage skeleton
  • Keep a clean heading outline
  • Test structure without CSS

About 14 minutes

From pieces to a whole page

You now own the vocabulary: headers, navs, mains, sections, articles, footers. Think of it as having learned the names of rooms. This lesson is about floor plans. When a client asks for a homepage, you should be able to look at a design and know, almost instantly, how to arrange the elements.

Read the design, then mark the regions

Take a typical business homepage. From the top down there is usually a bar with a logo and menu, a large welcoming banner, three feature boxes, an about paragraph with a picture, customer quotes and a footer with contact details. Before typing a tag, draw a rectangle around each region and name it. Those names become your elements.

header   logo + nav
main
  section  hero banner (h1, intro, button)
  section  three features (3 articles)
  section  about (text + figure)
  section  testimonials
footer   contact details + links

Putting it together

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Priya's Bakery | Fresh bread in Lahore</title>
  <meta name="description" content="Handmade sourdough and cakes baked every morning.">
</head>
<body>
  <header>
    <a href="index.html" class="logo">Priya's Bakery</a>
    <nav aria-label="Main">
      <a href="index.html">Home</a>
      <a href="menu.html">Menu</a>
      <a href="contact.html">Contact</a>
    </nav>
  </header>

  <main>
    <section class="hero">
      <h1>Bread worth waking up for</h1>
      <p>Baked fresh every morning in the heart of the city.</p>
      <a class="button" href="menu.html">See the menu</a>
    </section>

    <section class="features">
      <h2>What we bake</h2>
      <article>
        <h3>Sourdough</h3>
        <p>Slow-fermented for two days.</p>
      </article>
      <article>
        <h3>Celebration cakes</h3>
        <p>Made to order, decorated by hand.</p>
      </article>
      <article>
        <h3>Pastries</h3>
        <p>Buttery, flaky and gone by noon.</p>
      </article>
    </section>
  </main>

  <footer>
    <p>12 Mall Road, Lahore &middot; <a href="mailto:hello@example.com">hello@example.com</a></p>
  </footer>
</body>
</html>

Look at how readable this is even without any CSS. You can scan it like an outline. A new teammate could open the file and know where to add a testimonial.

Good to know

The aria-label on the nav gives it a name, which matters when a page has more than one navigation, such as a main menu and a footer menu. Screen readers announce the label so people know which one they are in.

Heading levels are the page outline

Headings form a hierarchy, like the chapters and sections of a book. A page usually has one h1 naming the page. Major sections get h2, their parts get h3, and so on, without skipping levels. Screen reader users often navigate by headings alone, so a messy outline is like a book with a scrambled contents page.

Common mistake

Do not pick heading levels for their size. If an h3 looks too small, fix the size with CSS. Choose the level for its place in the outline.

Common layout patterns

  • Sidebar layout. A main plus an aside with related links, side by side on desktop and stacked on phones.
  • Card grid. Repeated article elements in a container that CSS arranges in rows and columns.
  • Article page. A header with the title and date, a long article, an aside with related posts.
  • Landing page. Several full-width sections, each with one clear message, ending in a call to action.

Notice that all four share the same HTML ideas. Only the CSS arrangement changes. This is exactly why semantic HTML first, CSS second, is such a strong habit: the structure stays the same while the looks adapt to every screen.

Test your structure

  • Remove all CSS in your head. Does the page still read in a logical order?
  • Press the Tab key. Does focus move through links and buttons in the order a person would expect?
  • Run the page through the W3C validator and fix errors from the top down, because one unclosed tag can cause many later errors.
  • Open the browser’s developer tools and check the Accessibility panel, if it has one, for the outline.

Fill in this layout so that the page has a header with nav, a main containing a section with an h2 and a paragraph, an aside, and a footer.

<header>
  <!-- logo and nav -->
</header>
<main>
  <!-- section and aside -->
</main>
<!-- footer here -->

The aside can sit inside main, after the section. Finish with a footer containing a p.

<header>
  <a href="#">Logo</a>
  <nav><a href="#">Home</a> <a href="#">Contact</a></nav>
</header>
<main>
  <section>
    <h2>Welcome</h2>
    <p>This is the main section.</p>
  </section>
  <aside>
    <h2>Related</h2>
    <p>Links go here.</p>
  </aside>
</main>
<footer>
  <p>&copy; 2026</p>
</footer>
Use the meta viewport tag every time

The line <meta name="viewport" content="width=device-width, initial-scale=1"> tells phones to show the page at the device’s real width. Without it, mobile browsers zoom out and everything looks tiny.

Common layout mistakes and how to avoid them

  • Building the page from the visual look instead of the content. The order in the HTML should make sense when read alone. CSS can move things around visually, but a screen reader follows the source order.
  • Putting the navigation after the content. Place it at the top of the source so keyboard users meet it first, then use CSS if you want it elsewhere on screen.
  • Forgetting the language. Without lang="en", translation tools and screen readers may guess wrongly.
  • Duplicating the same menu in many places without labels. If you must, give each nav its own aria-label.
  • Leaving the title tag generic. Every page needs a unique title, because it appears in browser tabs, bookmarks and search results.

Take five minutes to review a page you built earlier against this list. Most pages fail at least one item, and fixing them is quick.

Practice: describe a layout in words

A useful exercise is to take any website you like and write its outline in plain words, the same way as the plan earlier in this lesson. Do it three times with different sites and you will start to see the same handful of patterns repeated everywhere. Once you can see the patterns, writing the HTML becomes the easy part.

Check what you learned

Five quick questions. Pick an answer and you will see straight away whether it is right and why.

What is the best first step before writing a page’s HTML?

  1. Choose colours
  2. Mark the regions of the design and name them
  3. Write the footer
  4. Add JavaScript

Naming regions turns a design into elements.

How many h1 elements does a page usually have?

  1. One
  2. One per paragraph
  3. Ten
  4. None

A single h1 names the page. Other headings form the outline beneath it.

What is aria-label on a nav for?

  1. Styling it
  2. Giving it a name for screen reader users
  3. Making it faster
  4. Hiding it

It distinguishes several navigation areas on one page.

Why not choose heading levels for their size?

  1. Browsers forbid it
  2. The level shows the outline; size belongs to CSS
  3. Smaller headings load faster
  4. It breaks links

Levels describe structure. CSS controls appearance.

What does the viewport meta tag do?

  1. Adds a favicon
  2. Makes pages display at device width on phones
  3. Blocks search engines
  4. Sets the page language

Without it, mobile browsers shrink the whole desktop layout.

Summary

  • Plan first: mark and name each region of the design.
  • One h1, then h2 and h3 in order.
  • The same semantic structure supports many layouts.
  • Always include the viewport meta tag.

Next lesson

A page is not only text and pictures. Next: bring in sound and video.

Questions

Where does CSS fit in?

CSS controls how these elements look and how they are arranged on the screen. The CSS course shows how to turn this skeleton into a styled page.

Should every section have a heading?

Ideally yes. A section without a heading is usually better as a div, unless you label it with aria-label.

Can I nest sections inside articles?

Yes. Articles may contain sections, and sections may contain articles. Choose by meaning.

Progress is saved in this browser.