Frames Syntax

A frame document has no BODY, it is a layout in which other documents are displayed.

Process for coding frames

  1. Code the first page with the layout the windows that subdivide your screen (frameset command)
  2. Name each window. This is refered to as a window-target.
  3. Code each separate page (individual files) that will be the content of each window. These are called the source files.
  4. Code a "No Frames" option for noframes browsers such as some versions of the AOL browser, lynx

<frameset>, <frame>, <noframes>

To make a page use frames, add a <frameset> tag immediately after <head> (this new tag effectively replaces <body>. This tag takes two attributes, cols and rows, which specify the space taken by each frame in the form of a comma-separated list. You can specify either the number of pixels to use, a percentage, or "*" to mean the rest of the space once the other values have been worked out. For instance, <frameset rows="40,20%,*"> would divide the window into three rows, the top-most being 40 pixels deep, the middle one taking 20% of the window, and the bottom one taking the remainder of the space.

Note that you don't have to specify cols and rows in the same <frameset> tag. Leaving e.g. rows out will assume you only want one row (and the same goes for columns); if you want a complicated layout involving both columns and rows, you can use another <frameset> inside to divide the window up further.

Once you've specified how the window is to be divided up with the <frameset> tag, you then describe the contents of each frame using <frame> (alternatively, replace this by another <frameset> to divide the frame into several other frames). This tag takes the following attributes:

Don't forget the ending </frameset> tag.

Use the <noframes> tag to specify what non-frame-savvy browsers should display. This should be a standard HTML page, i.e. with <html>, <head>, <body>, the works. Frame-capable browsers will ignore anything between <noframes> and </noframes>.

<a> extended - target windows

From version 2.0 onwards, Netscape allows you to "target" a specific window with <a href=URL target=name>. (You can also use target with <base>, <area> and <form>). The linked page is opened in the corresponding window, if it exists; otherwise, a new one is opened. Relying on targetting a new window so people will be able to see two pages at once is not a reasonable thing to do.

You can define a default target for all links with the <base> tag.

The following special values can also be used as names:

Frames syntax example from Netscape

mit Comments to
$Date: 2001/10/31 21:26:12 $