Simple HTML and CSS

Frames

Frames let you split the screen into rectangular areas, and show different content in each area. That is useful if you want to keep a menu visible at all times, like at the top or side of the screen, while the rest of the screen shows the content invoked through that menu.

A HTML file that specifies the frame structure has a frameset tag where normal files have the body tag. It divides the screen into two of more horizontal parts, or into two or more vertical areas. Within the frameset you put frame tags, each of which refers to a separate HTML file, which contains the content for that area of the screen.
Nested framesets: A frameset can be within another frameset, which means a vertical part of the screen can be subdivided horizontally, or a horizontal part can be subdivided vertically.

A frameset tag might look like this:

<frameset rows="15%,85%">
   <Frame NAME="upper" SRC="upper.htm">

   <frameset cols="20%,80%">
       <Frame NAME="left" SRC="left.htm">

       <Frame NAME="text" SRC="text.htm">
   </frameset>
</frameset>

In addition to NAME and SRC other options are possible, like frameborder, marginwidth, marginheight, noresize and scrolling. For details see the specification by the World Wide Web consortium, chapter 16.2.2, or this explanation in the Dutch language site Handleiding HTML, by Hans de Jong.

Some sources recommend to add a <noframes> tag, for browsers that do not support frames. But there are hardly any browsers around any more without the ability to display frames. Even the non-graphical browser lynx, which cannot visually show frame content, still makes it accessible, even if there is no <noframes>. This means <noframes> is probably unnecessary.

A disadvantage of frames is that they make it difficult to handle hyperlinks.


Previous Start

Copyright © 2002 R. Harmsen