HTML FRAMESET
HTML frames are used to divide your browser window into multiple sections
where each section can load a separate HTML document. A collection of
frames in the browser window is known as a frameset. The window is divided
into frames in a similar way the tables are organized: into rows and
columns.The <frameset> tag defines a frameset.
The <frameset> element holds one or more <frame> elements. Each
<frame> element can hold a separate document.
The <frameset> element specifies HOW MANY columns or rows there will be
in the frameset, and HOW MUCH percentage/pixels of space will occupy each
of them.
<html>
<head>
<title>HTML Frames</title>
</head>
<frameset rows = "10%,80%,10%">
<frame name = "top" src = "/html/top_frame.html" />
<frame name = "main" src = "/html/main_frame.html" />
<frame name = "bottom" src = "/html/bottom_frame.html" />
<noframes>
<body>Your browser does not support frames.</body>
</noframes>
</frameset>
</html>
The <frameset> Tag Attributes
Following are important attributes of the <frameset> tag −
Sr.No Attribute & Description
1
cols
Specifies how many columns are contained in the frameset and the size
of each column. You can specify the width of each column in one of the
four ways −
Absolute values in pixels. For example, to create three vertical frames,
use cols = "100, 500, 100".
A percentage of the browser window. For example, to create three
vertical frames, use cols = "10%, 80%, 10%".
Using a wildcard symbol. For example, to create three vertical frames,
use cols = "10%, *, 10%". In this case wildcard takes remainder of the
window.
rows
This attribute works just like the cols attribute and takes the same
2 values, but it is used to specify the rows in the frameset. For example, to
create two horizontal frames, use rows = "10%, 90%". You can specify
the height of each row in the same way as explained above for columns.
border
3 This attribute specifies the width of the border of each frame in pixels.
For example, border = "5". A value of zero means no border.
frameborder
This attribute specifies whether a three-dimensional border should be
4
displayed between frames. This attribute takes value either 1 (yes) or 0
(no). For example frameborder = "0" specifies no border.
framespacing
This attribute specifies the amount of space between frames in a
5
frameset. This can take any integer value. For example framespacing =
"10" means there should be 10 pixels spacing between each frames.
The <frame> Tag Attributes
Following are the important attributes of <frame> tag −
Sr.No Attribute & Description
src
1 This attribute is used to give the file name that should be loaded in the
frame. Its value can be any URL. For example, src =
"/html/top_frame.htm" will load an HTML file available in html directory.
name
2 This attribute allows you to give a name to a frame. It is used to indicate
which frame a document should be loaded into.
frameborder
This attribute specifies whether or not the borders of that frame are
3 shown; it overrides the value given in the frameborder attribute on the
<frameset> tag if one is given, and this can take values either 1 (yes) or
0 (no).
noresize
By default, you can resize any frame by clicking and dragging on the
6
borders of a frame. The noresize attribute prevents a user from being
able to resize the frame. For example noresize = "noresize".
scrolling
This attribute controls the appearance of the scrollbars that appear on
7
the frame. This takes values either "yes", "no" or "auto". For example
scrolling = "no" means it should not have scroll bars.
<frameset rows="16%,84%">
<frameset cols="50%,50%">
<frame src="tl.html" name="tl">
<frame src="tr.html" name="tr">
</frameset>
<frame src="bottom.html" name="bottom">
</frameset>
<frameset rows="16%,84%">
<frame src="top.html" name="top">
<frameset cols="50%,50%">
<frame src="left.html" name="left">
<frame src="right.html" name="right">
</frameset>
</frameset>
<frameset rows="50%,50%" cols="50%,50%">
<frame src="topleft.html" name="topleft">
<frame src="topright.html" name="topright">
<frame src="botleft.html" name="botleft">
<frameset rows="50%,50%">
<frameset cols="50%,50%">
<frame src="brtl.html" name="brtl">
<frame src="brtr.html" name="brtr">
</frameset>
<frame src="botrbot.html" name="botrbot">
</frameset>
</frameset>