Intro to Frames

Frames are an advanced HTML technique that allow you to divide pages into separate sections that scroll independently, with each section displaying the contents of a separate HTML document. This online textbook is an example of the use of frames. (You can see another example at http://slumberland.org/gene/.)In each chapter, there is a menu bar on the left side of the window, and content on the right side. You can scroll the content on the right side up and down, and the menu will not move.

Frames are a bit different from the HTML you're used to. When you create frame pages, instead of creating a normal page with a BODY, you create a page called a FRAMESET. The frameset is merely a structure. It doesn't contain any content at all. Inside the frameset structure are FRAMES, which link to outside content. Then, when the frameset page is viewed in the browser, the outside content is displayed in the frames.

For example, this page that you see now is a frameset with three frames, the header frame, the menu frame, and the content frame. The header frame links to a separate page that contains a red background, and the words "Chapter Eight." The menu frame links to a separate page that contains a yellow background, and the menu. And the content frame links to a separate page that contains the content you're reading now. When you look at this page, you're seeing the result of four different pages.

Basic Frame Tags

Let's take a look at the basic frame tags before we try our hand at some frames.

<FRAMESET> </FRAMESET>
Contains the entire frameset structure itself. Attributes of this tag include: BORDER, ROWS, and COLS. If a page has a FRAMESET, it cannot have a BODY.
<FRAME>
This defines the contents of a frame within a frameset. Attributes of this tag include: SRC, MARGINWIDTH, MARGINHEIGHT, SCROLLING, and NORESIZE.
<NOFRAMES> </NOFRAMES>
Contains the text to be displayed by web browsers that don't support frames. It's important to use this, because if you don't, a browser that doesn't support frames will be completely unable to use your site.

<<-------- p r e v // a i w e b // n e x t -------->>