Slide 2.19: HTML forms and input (cont.)
Slide 2.21: HTML iframes
Home

HTML Frames


With frames, you can display more than one web page in the same browser window. Each HTML document is called a frame, and each frame is independent of the others. The frameset tag includes the following features: The disadvantages of using frames are The example below has a frameset with two columns. The first column is set to 30% of the width of the browser window. The second column is set to 70% of the width of the browser window.

The HTML document 1p.html is put into the first column, and the HTML document 2p.html is put into the second column:
 <frameset cols="30%,70%">
   <frame src="1p.html" />
   <frame src="2p.html" />
 </frameset>

If a frame has visible borders, the user can resize it by dragging the border. To prevent a user from doing this, add the attribute and its value noresize="noresize" to the frame tag. Add the <noframes> tag for browsers not supporting frames.

Tag Description Tag Description
<frameset> Defines a set of frames. <frame> Defines a sub window (frame).
<noframes> Defines a noframe section for browsers that do not handle frames. <iframe> Defines an inline sub window (frame).

Do not use the body element on a page containing frames. The frames will not work if it is the case.

Demonstration
The following demonstration shows how the HTML script is displayed on the Web.