Summary -
In this topic, we described about the below sections -
HTML Frames are actually sections in a HTML page. HTML Frames are used to create sections in HTML page. Each section can be loaded from separate HTML document. The window is divided into frames in similar way the tables are organized.
<frame> tag is used to create frames in HTML document. A collection of Frames in the HTML document is called as a Frameset. <frameset> tag is used to represent the Frameset.
Disadvantages -
- Some browsers won’t support frames.
- Page displays differently for different resolution.
- Back button won’t work properly sometimes.
Let us discuss in detail about <frame> and <frameset> tags.
<frame> tag
The <frame> tag is not supported in HTML5. To define a window in another window or frameset. The <frame> tag used to define frame within a <frameset>.
The <frameset> can contain multiple frames (<frame>). Each <frame> element can have different attributes and refer to the separate document. There is no end tag required in HTML for <frame> tag.
Syntax -
<frame>.. text here.. </frame>
Optional Attributes -
Attribute | Description | Values |
---|---|---|
Frameborder | Specifies whether frame border displays or not | 01 |
Marginheight | Specifies the top and bottom margins of the frame | Pixels |
Marginwidth | Specifies the left and right margins of the frame | Pixels |
Name | Specifies the name of the frame | Text |
Noresize | Specifies the frame is not resizable | Noresize |
Scrolling | Specifies frame defined is scrollable or not | Auto No Yes |
Src | Specifies the source of the page to show in frame | URL |
<frameset> tag
The <frameset> tag is not supported in HTML5. Define a Frameset. The <frameset> tag used to define a frameset. <frameset> contains frames(<frame>).
A <frameset> can contain multiple <frame> elements. Each <frame> element can have different attributes and refer to the separate document. The <frameset> element specifies the frames number and occupancy.
Syntax -
<frameset>.. text here.. </frameset>
Optional Attributes -
Attribute | Description | Values |
---|---|---|
Cols | Specifies the number and size of columns in a frameset. | Pixels % * |
Rows | Specifies the number and size of rows in a frameset. | Pixels % * |
Example -
<!DOCTYPE html>
<html>
<head>
<title>Frameset example</title>
</head>
<body>
<frameset cols="20%,20%,25%,*">
<frame src="frame1.htm">
<frame src="frame2.htm">
<frame src="frame3.htm">
<frame src="frame4.htm">
</frameset>
</body>
</html>