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
- Frames are not expected to be supported in future versions of HTML
- Frames are difficult to use. (Printing the entire page is difficult).
- The web developer must keep track of more HTML documents
The HTML frameset Element
The frameset element holds one or more frame elements. Each frame element can hold a separate document. The frameset element states How many columns or rows there will be in the frameset, and how much percentage/pixels of space will occupy each of them.
The HTML frame Element
The <frame> tag defines one particular window (frame) within a frameset. For example below we have 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 document "frame_1.htm" is put into the first column, and the document "frame_2.htm" is put into the second column:
<frameset cols="30%,70%">
<frame src="frame_1.htm" />
<frame src="frame_2.htm" />
</frameset>
The frameset column size can also be set in pixels (cols="300,400"), and one of the columns can be set to use the remaining space, with an asterisk (cols="30%,*").
Basic Notes
If a frame has visible borders, the user can resize it by dragging the border. To prevent a user from doing this, you can add noresize="noresize" to the <frame> tag. Add the <noframes> tag for browsers that do not support frames. You cannot use the <body></body> tags together with the <frameset></frameset> tags! However, if you add a <noframes> tag containing some text for browsers that do not support frames, you will have to enclose the text in <body></body> tags! See how it is done in the first example below.
HTML Frame Tags
Tag Description
<frameset> Defines a set of frames
<frame /> Defines a sub window (a frame)
<noframes> Defines a noframe section for browsers that do not handle frames
HTML Beginner tutorial 15 : HTML Iframes >>
<< HTML Beginner tutorial 13 : HTML Lists
No comments:
Post a Comment