Frames allow you to set up multiple windows to display multiple documents or files.
The most common use for frames is a menu-content arrangement, with a menu of items in
one frame and the main content of the page in the other. frames, unfortunately, have a
bad reputation, mainly from people incorrectly using them. The ultimate goal when using
frames, or more HTML for matter, is for the user to be unaware of the existance of the
frames. When using frames, you must first decide on what layout, whether to have columns
or rows, or a combination, what dimensions they should be and so on. The actual code for
setting up the frames comes in two parts - <frameset> which sets up the columns or rows,
and their dimensions, and <frame> which defines the files to be used in the frames. Below
is the syntax for these tags.
This would display a frameset with menu.htm before start.htm
ROWS/COLS specifies whether you want rows or columns. What follows that are the units you can
define the rows/columns in. X is for an absolute pixel value. This is good if you're using an
image map. NN% is percentage value between 1 and 100, while * means "whatever is left over".
Using * is good for when you use an absolute pixel reference, as the display resolution doesn't
matter. Note that the values for the sizes of your frames must be seperated by a comma (,).
<frame src="file.html"> specifies the location of the file to be used in the frame. Name gives
the frame a name so it can be referenced, mainly for referencing via links (with the use of
<a href="file.htm" target="name">). Be aware that some names are reserved and cannot be used.
These include _blank, _self, _parent, and _top. </frameset> closes the tag.
Rather than continously specifying the target window in the link, you can use the <base> tag.
By using <base target="window_name"> in your menu or link section, you can bypass the need to
use target="window_name" in the individual links.
One other interesting tag in this area is <noframes>, which will be displayed, in non-frame
able browsers. Also note the lack of the <body> tag in the above example. This is because under
Netscape, if you include a <body> tag, the frames will not display.
Further variables for <frameset> include border=X which specifies, in pixels, the border between
two frames, with values down to and including 0, while frameborder=X specifies the width of the grey
bar you may have seen on some framed pages between the frames. By using values of zero for both, you
can give the illusion of a frameless page. Other variables for <frame> include marginwidth=X for the
left and right margins within the frame, marginheight=X for the top and bottom margins within the
frame, scrolling=YES/NO/AUTO where YES will force scrollbars, NO will force them off and AUTO lets
the browser decide (which is the default without using scrolling anyway). noresize stops the user
from dragging the frames.