Jomatter

How to Make More Than One Page in HTML

To make more than one page in HTML, create a separate .html file for each page and connect those files using HTML <a> links. HTML does not require you to place multiple pages inside one file. A typical website has several HTML documents, such as index.html, about.html, services.html, and contact.html, with navigation links that allow visitors to move from one page to another.

Create Separate HTML Files

Start by creating one HTML file for every page you need. For example, a basic website with four pages can have this structure:

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

The index.html file is commonly used as the homepage. The other files contain the content for their respective pages.

Each file should contain its own complete HTML document structure, including <!DOCTYPE html>, <html>, <head>, and <body>.

For example, index.html can contain:

<!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 another file named 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</title>
</head>
<body>

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

</body>
</html>

These are two separate HTML pages. Opening index.html shows the homepage, while opening about.html shows the About page.

Connect HTML Pages With Anchor Links

The <a> element creates a link to another page. The href attribute specifies the destination.

To link from index.html to about.html, use:

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

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

You can connect all pages by adding links to each document:

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

This navigation can be placed inside the <body> of every HTML page.

For example:

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

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

    <h1>Home Page</h1>
    <p>Welcome to the website.</p>

</body>
</html>

The same navigation can be added to about.html, services.html, and contact.html. This creates a simple multi-page website where users can move between documents.

Use Relative Paths Correctly

The href value must correctly point to the location of the target HTML file. When files are in the same folder, a simple filename is enough:

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

If the page is inside a subfolder, include the folder path:

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

From index.html, the link to the contact page would be:

<a href="pages/contact.html">Contact</a>

If you need to link from pages/contact.html back to index.html, move one directory level up using ../:

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

Incorrect file paths are a common reason for links showing a 404 Not Found error or failing to open the intended page.

Complete Example of a Multi-Page Website

A simple three-page website could use this structure:

website/
├── index.html
├── about.html
└── contact.html

The homepage:

<h1>Home</h1>

<a href="index.html">Home</a>
<a href="about.html">About</a>
<a href="contact.html">Contact</a>

The About page:

<h1>About</h1>

<a href="index.html">Home</a>
<a href="about.html">About</a>
<a href="contact.html">Contact</a>

The Contact page:

<h1>Contact</h1>

<a href="index.html">Home</a>
<a href="about.html">About</a>
<a href="contact.html">Contact</a>

Although the navigation code is repeated, each page remains an independent HTML document.

Can You Put Multiple Pages in One HTML File?

A normal multi-page website uses separate HTML files. You can simulate different views within one HTML document using CSS, JavaScript, sections, URL fragments, or a single-page application architecture, but those approaches are different from creating traditional multiple HTML pages.

For beginners and standard websites, separate .html files connected with <a href> links are the straightforward approach.

How Many HTML Pages Can You Create?

There is no fixed HTML rule that limits a website to a particular number of pages. You can create two pages, ten pages, hundreds of pages, or more. The important part is organizing the files properly and using correct links between them.

A larger website might look like:

website/
├── index.html
├── about.html
├── services.html
├── pricing.html
├── blog.html
└── contact.html

Each page can have its own <title>, headings, content, images, forms, and other HTML elements.

Conclusion

To make more than one page in HTML, create each page as a separate .html file and connect the files with <a href=""> links. Keep related pages organized in folders, use correct relative paths, and place consistent navigation on every page. This structure creates a traditional multi-page HTML website without requiring JavaScript or a web framework.

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 Create Multiple Web Pages In Html