The Wayback Machine - https://web.archive.org/web/20240709004556/https://www.geeksforgeeks.org/how-to-divide-an-html-page-into-four-parts-using-frames/
Open In App

How to divide an HTML page into four parts using frames ?

Last Updated : 23 Jan, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

This article shows how to divide a page into four parts using HTML frames. This can be used to represent the header, sidebar, footer, and main content. The frames are created using the <frame> tag. We will have to use four HTML files for each of the portions.

Syntax:

<frameset>
// frame elements
</frameset>

Example 1: This example will demonstrate the approach to create the four parts of the page.

HTML




// Home.html
 
<html>
 
<head>
    <title>Header</title>
    <style>
        h1 {
            text-align: center;
        }
    </style>
</head>
 
<body>
    <h1>Welcome to the home page</h1>
</body>
 
</html>


HTML




// Sidebar.html
 
<html>
 
<head>
    <title>Sidebar</title>
</head>
 
<body>
    <h3>Sidebar</h3>
    <a href="html_content.html" target="B">
        HTML
    </a><br>
    <a href="css_content.html" target="B">
        CSS
    </a><br>
    <a href="js_content.html" target="B">
        JS
    </a><br>
    <a href="php_content.html " target="B">
        PHP
    </a>
</body>
 
</html>


HTML




// header.html
 
<html>
 
<head>
    <title>Header</title>
    <style>
        h1 {
            color: green;
            text-align: center;
        }
    </style>
</head>
 
<body>
    <h1>GeeksforGeeks</h1>
</body>
 
</html>


HTML




// footer.html
 
<html>
 
<head>
    <title>Footer</title>
    <style>
        h4 {
            text-align: center;
        }
    </style>
</head>
 
<body>
    <h4>
        All Rights Reserved
    </h4>
</body>
 
</html>


HTML




// html_content.html
 
<html>
 
<head>
    <title>
        HTML content
    </title>
    <style>
        p {
            text-align: center;
        }
    </style>
</head>
 
<body>
    <p>Hyper Text Markup Language</p>
</body>
 
</html>


HTML




//css_content.html
 
<html>
 
<head>
    <title>CSS</title>
    <style>
        p {
            text-align: center;
        }
    </style>
</head>
 
<body>
    <p>Cascading Style Sheets</p>
</body>
 
</html>


HTML




//js_content.html
 
<html>
 
<head>
    <title>JS content</title>
    <style>
        p {
            text-align: center;
        }
    </style>
</head>
 
<body>
    <p>JavaScript</p>
</body>
 
</html>


HTML




//php_content.html
 
<html>
 
<head>
    <title>PHP Content</title>
</head>
<style>
    p {
        text-align: center;
    }
</style>
 
<body>
    <p>Hypertext Preprocessor</p>
</body>
 
</html>


Output:

We will now create the HTML pages of the four sections and the content of the main page separately. 

Output:

Example 2:Implementation to show how to divide an HTML page into four parts by using images.

HTML




<!DOCTYPE html>
<html>
 
<head>
    <title>Frame into 4 parts</title>
</head>
<frameset rows="250px, 250px" cols="250px, 250px">
    <frame src=
        <frame src=
            <frame src=
                name="frame3">
                <frame
                    src=
                    name="frame4">
</frameset>
 
</html>


Output:

hfg



Previous Article
Next Article

Similar Reads

How to update two frames at the same time using HTML ?
In this article, We are going to see how you can update two frames at the same time. Approach: We take two iframes with unique id names i.e. "frame1" and "frame2" both align to the center of our page and a button. When we click the button then the URLs of the iframes is replaced with other URLs. HTML Code: In this code, we attach one event listener
2 min read
HTML DOM Window frames Properties
The HTML DOM Window frames property in HTML DOM is used to return the frame element in the form of an array object. This property represents all &lt;iframe&gt; elements in the current window. DOM Windowframe is a read-only property. Syntax: window.frames Properties: length property: It returns the number of iframe elements in the current window. lo
2 min read
How to divide an image into different clickable link area using HTML?
An image can be divided into different clickable and linkable areas using an Image map. The Image map is used for navigation purposes. An image map consists of several tags: img: It specifies the image to be included in the map.map: It creates a map of clickable areas.area: It is used inside the map element to define the clickable areas. We can mak
2 min read
p5.js | frames() Function
The frames() function is an inbuilt function in p5.js library. This function is used to return the no of frames. There was a simple equation between samplesRate, duration, and frames. The equation is frames = samplesRate*duration. Syntax: frames() Note: All the sound-related functions only work when the sound library is included in the head section
1 min read
How to create frames ?
The task is to create frames using HTML. HTML is HyperText Markup Language, and it is the standard markup language for creating web pages. It describes the shape of a web page and includes a sequence of elements. Frames in HTML are used to divide your browser window into more than one section in which every phase can load a separate HTML report and
2 min read
How to redirect a page to another page in HTML ?
Redirecting a page in HTML involves sending users to a different web page automatically or upon interaction. This can be achieved using the anchor tag's href attribute or the meta tag with the http-equiv attribute set to refresh and the content attribute specifying the time delay and destination URL. Understanding these methods helps improve naviga
3 min read
JavaScript Program to Check if Given String can be Split into Four Distinct Strings
A string can be split into four distinct strings by identifying specific delimiters or patterns within the original string and extracting substrings based on these divisions, resulting in four separate and non-overlapping text segments. In this article, we will check if a given string can be split into four distinct strings. Table of Content Using
5 min read
How to display search result of another page on same page using ajax in JSP?
In this example, we are creating a search bar to display the result on the same page in using ajax in JSP. AJAX stands for Asynchronous JavaScript and XML. Where Ajax is mainly used for Displaying another web page content on the same web page without refreshment of the page. You can read more about ajax technology here. Approach: We use the JQuery
2 min read
How to divide text into two columns layout using CSS ?
The purpose of this article is to divide the text into two columns by using the CSS column property. This property is used to set the number of columns and the width of these columns. Syntax: columns: column-width columns-count | auto | initial | inherit; Example: C/C++ Code &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;style&gt; body { text-
2 min read
How to show Page Loading div until the page has finished loading?
There are a lot of ways in which we can show a loading div but we have figured out the most optimal solution for you and that too in pure vanilla JavaScript. We will use the document.readyState property. When the value of this property changes, a readystatechange event fires on the document object. The document.readyState property can return these
2 min read
three90RightbarBannerImg