Frames

We have been using tables to achieve a two-dimensional page layout. Frames can also be used for page layout.

With frames, you are create sub-windows, each of which may have it's own content and even scroll independently.

It may sound as though frames are always better than tables, but that is not the case. Many people prefer the appearance of a page that uses tables since it is unbroken and scrolls as a single unit.

Frames may also confuse beginning users who mistakenly assume that clicking on a link took them to a new page rather than just updating one frame. The behavior of the browser "back" button may confuse them, and, if they save a page as a "favorite," they may not come back to the view they thought they had saved.

Here is an artificial example of the use of frames. If you View Source for the page, you will see the definition of a frameset with two rows and three columns:

<frameset rows= "40%, *" cols = "30%, 20%, *"> <frame src = "f1.htm"> <frame src = "f2.htm" marginheight=40 marginwidth = 40> <frame src = "f3.htm"> <frame src = "f4.htm"> <frame src = "f5.htm"> <frame src = "f6.htm"> </frameset>

This defines six independent pages (f1.htm, f2.htm, etc.). To see the source on the individual pages, place the mouse over the frame, right click, and View Source.

The example shown above is contrived to illustrate the frame tags. This is a more realistic example

<frameset rows = "15%, *" > <frame src = "title.htm"> <frameset cols = "20%, *" > <frame src = "toc.htm"> <frame src = "fblank.htm" name = "articles" > </frameset> </frameset>

This defines a two row frameset. The first row is 15% of the screen, and contains the document title.htm. The second row contains another frameset. This frameset has two column frameset. The first column contains a frame with the table of contents, the second is the target for the articles.


Disclaimer: The views and opinions expressed on unofficial pages of California State University, Dominguez Hills faculty, staff or students are strictly those of the page authors. The content of these pages has not been reviewed or approved by California State University, Dominguez Hills.