HTML Frames
HTML Frames
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.
Disadvantages:
Some smaller devices cannot cope with frames often because their
screen is not big enough to be divided up.
Sometimes your page will be displayed differently on different
computers due to different screen resolution
The browser's back button might not work as the user hopes.
Creating Frames
To use frames on a page we use tag instead of tag. The tag defines, how to
divide the window into frames. The rows attribute of tag defines horizontal
frames and cols attribute defines vertical frames. Each frame is indicated by
tag and it defines which HTML document shall open into the frame.
Example:-For Creating Horizontal frames.
<html>
<head>
<title>HTML Frames</title>
</head>
<frameset rows="10%,80%,10%">
<frame name="top" src="/html/top_frame.htm" />
<frame name="main" src="/html/main_frame.htm" />
<frame name="bottom" src="/html/bottom_frame.htm" />
<noframes>
<body>
our browser does not support frames.
</body>
</noframes>
</frameset>
</html>
Ex2:-Creating Vertical frames
<frameset cols="25%,50%,25%">
<frame name="left" src="/html/top_frame.htm" />
<frame name="center" src="/html/main_frame.htm" />
<frame name="right" src="/html/bottom_frame.htm" />
</frameset>
Mixed Frame:-
<frameset rows="50%,50%">
<frame src="frame_a.htm">
<frameset cols="25%,75%">
<frame src="frame_b.htm">
<frame src="frame_c.htm">
</frameset>
Frame's name and target attributes:-
One of the most popular uses of frames is to place navigation bars in one
frame and then load main pages into a separate frame.