HTML Frames
Seema Sirpal
Delhi University Computer Centre
Frames
With frames, you can display more than one HTML document in
the same browser window. Each HTML document is called a
frame, and each frame is independent of the others.
The disadvantages of using frames are:
The web developer must keep track of more HTML documents
It is difficult to print the entire page
The Frameset Tag
The <frameset>
frameset tag defines how to divide the
window into frames
Each frameset defines a set of rows or columns
The values of the rows/columns indicate the amount
of screen area each row/column will occupy
The Frame Tag
The <frame> tag defines what HTML
document to put into each frame
<frameset cols="25%,75%">
<f
<frame src="frame_a.htm">
"f ht ">
<frame src="frame_b.htm">
</frameset>
Vertical frameset
<html>
<frameset cols="25%,50%,25%">
<frame
f src="frame_a.htm">
"f ht "
<frame src="frame_b.htm">
<frame src="frame_c.htm">
</frameset>
</html>
Horizontal frameset
<html>
<frameset rows="25%,50%,25%">
<frame src="frame_a.htm">
<frame src="frame_b.htm">
<frame
f src="frame_c.htm">
f
</frameset>
</html>
Useful Tips
If a frame has visible borders, the user can resize it byy dragging
gg g
the border. To prevent a user from doing this, you can add
noresize="noresize" to the <frame> tag.
Add the <noframes> tag g for browsers that do not support
pp frames.
Important: You cannot use the <body></body> tags together with the
<frameset></frameset> tags!
g
However, if you add a <noframes> tag containing some text for
browsers that do not support frames, you will have to
enclose
l the
th text
t t in
i <body></body>
b d /b d tags!
t !
Mixed frameset
<html>
<frameset rows="50%,50%">
<frame
f src="frame_a.htm">
"f ht "
<frameset cols="25%,75%">
<frame
f src="frame_b.htm">
"f b ht "
<frame src="frame_c.htm">
</frameset>
</frameset>
</html>
Frameset with noresize="noresize"
<html>
<frameset rows="50%,50%">
<frame
f noresize="noresize"
i " i " src="frame_a.htm">
"f ht "
<frameset cols="25%,75%">
<frame
f noresize="noresize"
i " i " src="frame_b.htm">
"f b ht "
<frame noresize="noresize" src="frame_c.htm">
</frameset>
</frameset>
</html>
Navigation frame
<html>
<frameset cols="120,*">
<frame src="tryhtml_contents.htm">
<frame src="frame_a.htm" name="showframe">
</f
</frameset>
t>
</html>
In “tryhtml_contents.htm"
<a href ="frame_a.htm" target ="showframe">Frame a</a><br>
<a href ="frame_b.htm" target ="showframe">Frame b</a><br>
<a href
h f ="frame_c.htm"
"f ht " target
t t ="showframe">Frame
" h f " F c</a>
/
How to use the <noframes> tag
<html>
<frameset cols="25%,50%,25%">
<frame src="frame_a.htm">
<frame
f src="frame_b.htm">
"f b ht "
<frame src="frame_c.htm">
<noframes>
f
<body>Your browser does not handle frames!</body>
</noframes>
</frameset>
</html>
Jump to a specified section with frame
navigation
<html>
<frameset cols="180,*">
cols 180, >
<frame src="content.htm">
<frame src="link.htm" name="showframe">
</frameset>
</html>
In "content.htm"
<a href ="link.htm" target ="showframe">Link without Anchor</a>
<br>
<a href ="link.htm#C10" target ="showframe">Link with Anchor</a>.