Jomatter

How to Create Multiple Web Pages in HTML

To create multiple web pages in HTML, create a separate .html file for each page and connect those files using HTML links with the <a> element. For example, a simple website can have index.html for the homepage, about.html for the About page, services.html for services, and contact.html for contact information. Each file contains its own HTML structure, while navigation links allow visitors to move between pages.

1. Create a Separate HTML File for Each Page

An HTML website can contain any number of pages. The simplest structure is to place all pages in the same folder:

my-website/
├── index.html
├── about.html
├── services.html
└── contact.html

The index.html file is normally used as the homepage. The other files represent separate sections of the website.

Each page should have a complete HTML document structure containing <!DOCTYPE html>, <html>, <head>, and <body> elements.

For example, create index.html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Home</title>
</head>
<body>

    <h1>Welcome to My Website</h1>
    <p>This is the homepage.</p>

</body>
</html>

Then create about.html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>About Us</title>
</head>
<body>

    <h1>About Us</h1>
    <p>This page contains information about the website.</p>

</body>
</html>

These are two independent web pages. The browser loads whichever HTML file is requested.

2. Connect the Pages With Links

Creating separate files does not automatically connect them. You need hyperlinks using the <a> element.

Add this navigation to index.html:

<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>

The href attribute tells the browser which file to open.

For example:

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

When a visitor clicks About, the browser opens about.html.

You should usually place the same navigation on every page so visitors can move between the site’s main sections.

3. Create a Complete Multi-Page Website

A practical four-page website could use this structure:

my-website/
├── index.html
├── about.html
├── services.html
├── contact.html
└── style.css

The homepage might contain:

<h1>My Business</h1>
<p>Welcome to our website.</p>

The About page can contain company information, the Services page can list offerings, and the Contact page can provide contact details or a form.

The important part is that every page uses links to the other pages.

4. Use Relative URLs Correctly

When pages are stored in the same directory, use a relative URL such as:

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

When a page is inside a folder, the path changes.

For example:

my-website/
├── index.html
├── about.html
└── services/
    └── seo.html

From index.html, you can link to the SEO page with:

<a href="services/seo.html">SEO Services</a>

From services/seo.html, a link back to the homepage would be:

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

The .. means to move up one directory.

Correct relative paths are essential because an incorrect path produces a broken link or a 404 error when the website is hosted.

5. Use One Shared CSS File

Multiple pages can use the same stylesheet instead of repeating CSS in every HTML file.

Create style.css:

body {
    font-family: Arial, sans-serif;
    margin: 40px;
}

nav a {
    margin-right: 20px;
    text-decoration: none;
}

Then add this inside the <head> of every HTML page:

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

This gives all pages a consistent design. You can change the site’s visual appearance by editing the shared CSS file rather than modifying each page individually.

The CSS path must also match the page’s location. For example, a page inside a services folder may need:

<link rel="stylesheet" href="../style.css">

6. Reuse the Same Header and Navigation

A common multi-page website keeps the header, logo, navigation, and footer consistent across pages.

For example:

<header>
    <h1>My Website</h1>

    <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>
</header>

You can copy this structure into each page and change only the main content.

For a small static HTML website, this is straightforward. Larger websites may use templates, a static site generator, JavaScript components, or a server-side system to avoid manually duplicating the same header and footer.

7. Add Images and Other Assets

You can also organize images, JavaScript, and CSS into separate folders:

my-website/
├── index.html
├── about.html
├── services.html
├── contact.html
├── css/
│   └── style.css
├── js/
│   └── script.js
└── images/
    └── logo.png

A page can load the stylesheet with:

<link rel="stylesheet" href="css/style.css">

And an image with:

<img src="images/logo.png" alt="Company logo">

Organizing files this way becomes increasingly useful as the website grows.

8. Test the Links Before Publishing

Open index.html in a browser and click every navigation link. Confirm that each page loads correctly and that links work in both directions.

Check especially for differences in filenames and capitalization. A link to:

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

is not necessarily the same as:

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

on hosting environments where filenames are case-sensitive.

Also verify links to CSS, JavaScript, images, and pages inside subdirectories.

9. Publish the Website

Once the pages work locally, upload the complete website structure to your web server or hosting account. The directory structure and relative paths should remain consistent after uploading.

For example, if index.html is in the site’s root directory and about.html is beside it, this link remains:

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

The same approach works whether the files are opened locally or served from a web server.

Complete Example

A basic index.html can look like this:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>My Website</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>

<header>
    <h1>My Website</h1>

    <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>
</header>

<main>
    <h2>Home Page</h2>
    <p>Welcome to my website.</p>
</main>

</body>
</html>

The other pages can use the same structure while changing the page title and main content.

In practice, creating multiple web pages in HTML is mainly a matter of creating separate .html documents, organizing them into a logical folder structure, and connecting them with accurate relative links. A shared CSS file keeps the design consistent, while organized asset folders make the project easier to maintain as more pages are added.

Also Read This Articles

How To Open A Link In A New Tab Html
How To Upload Html File To WordPress
How To Add Schema Markup To Html
How To Call A Function In Javascript From Html
How To Center An Iframe In Html
How To Change Plain Text Email To Html
How To Make Text Wrap Around An Image In Html
Are Html And Css Programming Languages
Do My Html Homework
How To Add Alt Tags To Images In Html
How To Link A Css File To An Html File