Frames
Frames allow multiple HTML documents to function at the same time in one browser window. The documents can operate independently, but the power of frames derives from the ability for a hyperlink in one frame to change the contents of another frame.

This site illustrates a typical configuration of three frames. The left frame contains a menu, consisting of hyperlinks that launch various pages that appear in the right frame, while the top frame contains a static banner that displays continuously.

Frames —hate 'em or love 'em

Many web design experts tell you that frames are a bad idea, for reasons discussed below in "What's wrong with Frames?" But in spite of everything, frames are still used by many Web developers because they're easier to maintain than non-frame sites.

Mary's advice: Use "includes" rather than frames. You can avoid frames and achieve a similar effect by inserting the menu or nav bar as a Server Side Include (SSI). Using this technique, you create the menu as you would for a frame structure - as a separate file. Rather than insert the menu directly into each page of your Web site, you insert code that instructs the server to place the contents of that file in a certain place on your pages when it displays the page on the user's screen. So you can update that menu file separately, and it is automatically updated on every page where the "include" code has been placed. Here's a tutorial that explains how to use includes to place a menu or nav bar on your pages. Please note that SSI can be used for many other purposes, so you'll be glad you learned about this Web development tool.

Why Web developers use frames

A popular use for frames is a structure that places the menu or navigation buttons in the top or left frame, which keeps the menu visible at all times, even if the reader scrolls to read the contents of another frame. This site uses such a system.
Note: You can achieve much the same effect by constructing your Web site with tables, placing the menu buttons in the same place on every page, just as you would with a frame site, it appears as if they remain static, but as you scroll down the page, the menu buttons move up, and may disappear from view. Another drawback to the tables construction is that when you update the menu, the changes must be made on every page in the site. This problem is rather easily solved by HTML editors such as Dreamweaver that allow you to create elements of the Web site such as the menu (or navbar) as a "library" item. When you update the library item, it is updated on every page.
Another good use for frames is to provide a static frame that contains information you want to display at all times, such as a logo banner, title bars, instructions or copyright information. Such frame sites are easy to construct, yet they present information in a very organized fashion and do not appear simple at all.
What's wrong with Frames?
Here are some of the common complaints about frames:
  • You can't bookmark individual pages within a framed site. As you'll notice, when you select a menu option and a new page displays in the right frame, the URL in the browser's "Location" field remains the same.
  • When you print a page on a framed site, you must be sure the cursor is in the frame you wish to print.
  • Some people find navigation within a framed site confusing.
As noted earlier in this article, you can avoid these problems by using SSI.

Tutorials on building Frame sites

If you choose to use frames, you will be glad to know that all HTML editors provide easy, automated processes for creating framed Web sites. But you'll want to know how the whole process works, so check out manda.com's tutorial: Introduction to Frames.

Last updated October 18, 2004