Alexander Spiteri's Home Page

HTML
Frames
 
Basic Frame Sintax
 
To use frames, you must create a document that uses the FRAMESET and FRAME elements to divide the browser's main window into rectangular areas (frames), like panes in a window. Then, for each frame, you specify an HTML document that contains the content to fill the frame.

For example, here's the code necessary to divide the main window into two equal frames, each one filled with different documents:

<HTML>
<HEAD>
<TITLE>2 Equal Frames</TITLE>
</HEAD>
<FRAMESET COLS="50%,*">
   <FRAME SRC="document1.html">
   <FRAME SRC="document2.html">
</FRAMESET>
</HTML>

As you can see, a frame document is very much like any normal HTML document, except the BODY container is replaced by a FRAMESET, which describes the frames that will make up the page.

You can divide the main window into columns, using the COLS attribute as in the example, as well as rows, using the ROWS attribute.
Furthermore, it's possible to divide individual frames into rows or columns, by nesting FRAMESET elements:

<FRAMESET ROWS="20%,*">
   <FRAMESET COLS="25%,*">
      <FRAME SRC="document1.html">
      <FRAME SRC="document2.html">
   </FRAMESET>
   <FRAMESET COLS="50%,*">
      <FRAME SRC="document3.html">
      <FRAME SRC="document4.html">
   </FRAMESET>
</FRAMESET>

Here's a quick explanation of the two tags used to create frames:

FRAMESET

 
 

ROWS="value-list"

The ROWS attribute takes as its value a comma separated list of values.
These values can be absolute pixel values, percentage values between 1 and 100, or relative scaling values (using the symbol *).
The number of rows is implicit in the number of elements in the list.
Since the total height of all the rows must equal the height of the window, row heights might be normalized to achieve this.

COLS="value-list"

The COLS attribute takes as its value a comma separated list of values that is of the exact same syntax as the list described above for the ROWS attribute.

 
FRAME
 
 

NAME="window-name"

The NAME attribute is used to assign a name to a frame so it can be targeted by links in other documents. See Window Control.

SRC="url"

The SRC attribute takes as its value the URL of the document to be displayed in this particular frame.

SCROLLING="yes|no|auto"

The SCROLLING attribute is used to describe if the frame should have a scroll bar or not. "auto" instructs the browser to decide whether scroll bars are needed, and place them where necessary.

NORESIZE

The NORESIZE attribute has no value. It is a flag that indicates that the frame is not resizable by the user.

 
These tags and attributes, like others not mentioned here, are further documented in the other subjects of this section.
 
Related Topics
 
FRAMESET element - FRAME element
 
Index
 
 

Introduction
Basic Frame Sintax
Window Control
Examples
Floating Frames

 
Back to Alexander Spiteri's Home