Creating and Using Frames

Main Page | FRAMESET Tags | FRAME Tags | NOFRAMES Tags


FRAMESET

The FRAMESET tag is used to define the group of frames that appear inside the browser window. Inside the FRAMESET tag, you use the FRAME tags and the NOFRAMES tags to define specific characteristics of individual frames, and what should be displayed if the client does not support frames.

FRAMESET tags are placed inside an HTML document referred to as a frame definition document. This document contains the layout for each frame and frameset. There is no BODY tag used in the frame definition document. Text to be displayed for browsers that do not recognize the FRAME tags is contained within the NOFRAMES tags.

The syntax for the FRAMESET tag is:

<FRAMESET BORDER=Width in Pixels
BORDERCOLOR=Colour Value
FRAMEBORDER=YES|NO
COLS=Column Width List|ROWS=Row Width List>
</FRAMESET>

The descriptions for the FRAMESET attributes are:

BORDER
Specifies the thickness of frame borders for all frames in the frameset. A value of 0 causes all frames to have no border. If no BORDER tag is given, the default is 5 pixels in Netscape Navigator. The BORDER tag may only be used for the outer- most FRAMESET.
BORDERCOLOR
Specifies the color of the frameset border. Some discrepancies may be displayed when frames within the frameset have different border colors specified.
FRAMEBORDER
YES displays an outline 3-D border, NO displays a plain border.
COLS|ROWS
Either the COLS or the ROWS attribute is required to defined the frames contained within this frameset. The Width List is a comma-delimited list which specifies the width of each of the columns or rows within the frameset. Valid values are:

  • Number of pixels
  • Percentage of window
  • asterisk (*) indicating: as much space as possible

FRAME

FRAME tags are used within the FRAMESET tags to define individual frames, which act as independent windows within the main window.

The syntax for the FRAME tag is:

<FRAME BORDERCOLOR=Colour Value
FRAMEBORDER=YES|NO
MARGINHEIGHT=Height in Pixels
MARGINWIDTH=Width in Pixels
NAME=Frame's Name
NORESIZE
SCROLLING=YES|NO|AUTO
SRC=URL>

The descriptions for the FRAME attributes are:

BORDERCOLOR
Specifies the color of the frame's border. Conflicts regarding border colors are resolved as follows:

  1. BORDERCOLORs in the outermost FRAMESET have the lowest priority.
  2. The BORDERCOLOR value is overridden by any BORDERCOLORs specified in nested FRAMESETs.
  3. BORDERCOLORs in the current FRAME tag overrides all previous FRAMESET BORDERCOLORs.
  4. Conflicts where both BORDERCOLOR attributes have equal priority are undefined and may produce unpredictable results.

FRAMEBORDER
YES displays an outline 3-D border, NO displays a plain border. Overrides the setting of the FRAMESET FRAMEBORDER value, but is only displayed if all frames adjacent to the Frameborder have the same setting.
MARGINHEIGHT
Specifies the number of pixels space to include between the top and bottom margins of a frame and its contents.
MARGINWIDTH
Specifies the number of pixels space to include between the right and left margins of a frame and its contents.
NAME
Specifies the name used to identify the individual frame for use as a TARGET value in hyperlinks and in JavaScript or VBScript.
NORESIZE
By default, the frame may be resized by the user once displayed in the browser. Adding this attribute prevents the user from resizing the frame.
SCROLLING
Specifies whether of not scroll bars are to be included with the frame. YES indicates that scroll bars are displayed, whether required by the content or not. NO indicates no scroll bars, whether required by the contents or not. AUTO allows the browser to display scroll bars only if required by the contents.
SRC
Identifies the URL of the default document to load in the frame when it is first created.

NOFRAMES

NOFRAMES are included, usually at the end of the FRAMESET to specify text to display if frames are not supported by the browser.

The syntax of the NOFRAMES is:

<NOFRAMES> </NOFRAMES>

There are no attributes for the NOFRAMES tags.


Here is an example of a FRAMESET which defines three frames in all. One frame across the entire width of the screen at the top of the screen and 100 pixels high; one frame 150 pixels wide on the left side of the screen, contained within the lower frame section; and one frame which fills the remainder of the lower frame section (lower right hand side). <FRAMESET BORDER=3 BORDERCOLOR="#FF0000" FRAMEBORDER=YES ROWS="100,*"> <FRAME MARGINHEIGHT=6 MARGINWIDTH=10 NAME="title" NORESIZE SCROLLING=NO SRC="title.html"> <FRAMESET BORDER=3 BORDERCOLOR="#0000FF" FRAMEBORDER=YES COLS="150,*"> <FRAME MARGINHEIGHT=3 MARGINWIDTH=5 NAME="menu" NORESIZE SCROLLING=AUTO SRC="menu.html"> <FRAME BORDERCOLOR="#00FF00" MARGINHEIGHT=6 MARGINWIDTH=10 NAME="main" SCROLLING=AUTO SRC="main.html"> </FRAMESET> <NOFRAMES> Sorry, you need a frames capable browswer in order to view this presentation. </NOFRAMES> </FRAMESET>

Here is a sample page constructed from the above definition.


Main Page | FRAMESET Tags | FRAME Tags | NOFRAMES Tags