← Web design from scratch

Create and connect multiple pages

So far, you’ve worked mainly with one page. In this lesson, you’ll turn your project into a website with several pages linked together.

Level · Beginner Time · 30–35 min Path · Web design

01

A website can have several pages

One HTML file may be enough for a simple site. Many projects benefit from giving different topics their own pages.

For example, a professional website might have these files.

index.html
about.html
services.html
contact.html

Each file represents a different page on the same site.

02

Organise your project

Your project folder might look like this.

my-first-website/
├── index.html
├── about.html
├── services.html
├── contact.html
├── styles.css
└── images/
    └── project.jpg

All the HTML files can share the same styles.css.

A clear folder structure makes errors easier to avoid as your project grows.

03

Create the About page

Create a new file named:

about.html

Start with this structure.

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>About | My project</title>
  <link rel="stylesheet" href="styles.css">
</head>

<body>

  <h1>About the project</h1>

  <p>
    Introduce your project here.
  </p>

</body>

</html>

04

Link Home to About

From index.html, add this link.

<a href="about.html">About</a>

When someone selects it, the browser looks for about.html in the same folder.

To return to Home from about.html, add this link.

<a href="index.html">Home</a>

05

Reuse the same navigation

Give visitors a way to reach the rest of the site from every page.

Reuse this menu on each page.

<nav>
  <a href="index.html">Home</a>
  <a href="about.html">About</a>
  <a href="services.html">Services</a>
  <a href="contact.html">Contact</a>
</nav>
When you edit a menu by hand on a static site, update it on every page where it appears.

06

What is a relative path?

A path tells the browser where to find a file.

When you write this:

href="services.html"

you’re using a relative path.

The browser looks for services.html relative to the location of the current document.

07

Link to pages in subfolders

Imagine your project has this structure.

my-first-website/
├── index.html
├── styles.css
└── pages/
    └── services.html

From index.html, use this link to reach Services.

<a href="pages/services.html">Services</a>

From services.html, go up one folder to return to Home.

<a href="../index.html">Home</a>

The two dots in:

../

mean “go up one folder”.

08

Why does a 404 error happen?

A 404 error means the server could not find the requested resource.

Here are some common causes.

01

The file doesn’t exist.

02

The file name is misspelt.

03

The path points to the wrong folder.

04

The uppercase and lowercase letters don’t match.

09

Keep file names consistent

Use simple, descriptive file names.

Here are some examples.

web-design.html
about-us.html
contact.html

Avoid spaces in file names.

My Services Page.html

Use a name like this instead.

services.html

10

Keep a consistent look across pages

Each page can have different content while still feeling like part of the same site.

01

Use the same navigation.

02

Keep the same fonts.

03

Reuse the colour palette.

04

Style similar buttons consistently.

05

Use similar spacing and content widths.

Sharing styles.css makes this easier.

11

Build a simple multi-page site

For practice, create four pages.

index.html
about.html
services.html
contact.html

Add this line to the head of each page:

<link rel="stylesheet" href="styles.css">

and use the same navigation menu on all four pages.

You now have a small website whose pages visitors can navigate.

12

Check every link

Before publishing, navigate the site as a visitor would.

01

Home → About.

02

About → Services.

03

Services → Contact.

04

Contact → Home.

Check buttons, images and links to sections too.

Test the navigation after each major change to your file structure.

What you’ve learned

  • A website can contain several HTML files.
  • index.html usually represents the homepage.
  • Links connect different pages.
  • Relative paths depend on the current file’s location.
  • ../ goes up one folder.
  • An incorrect path can cause a 404 error.
  • Use clear, consistent file names.
  • Multiple pages can share one styles.css file.
  • Keep navigation consistent across pages.
  • Test all links before publishing.

Turn your project into a multi-page site

Use the project you’ve built throughout this course.

  1. Keep index.html as the homepage.
  2. Create about.html.
  3. Create services.html.
  4. Create contact.html.
  5. Link styles.css from all four pages.
  6. Add the same navigation menu to each page.
  7. Check all the paths.
  8. Visit each page in your browser.
If you get a 404 error, start with the link. Check the exact file name and the path in href.

PREVIOUS LESSON

← 08 · Add images, buttons and links