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 -

  1. Some browsers won’t support frames.
  2. Page displays differently for different resolution.
  3. 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 -

AttributeDescriptionValues
FrameborderSpecifies whether frame border displays or not01
MarginheightSpecifies the top and bottom margins of the framePixels
MarginwidthSpecifies the left and right margins of the framePixels
NameSpecifies the name of the frameText
NoresizeSpecifies the frame is not resizableNoresize
ScrollingSpecifies frame defined is scrollable or notAuto No Yes
SrcSpecifies the source of the page to show in frameURL

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

AttributeDescriptionValues
ColsSpecifies the number and size of columns in a frameset.Pixels % *
RowsSpecifies 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>

Output -