frameset tag
iframe tag
noframes tag
body tag
head tag
TAG: frame
<frame ... >
Available in versions: 4.0
Browser compatibility: Explorer 4, 5 Netscape 4, 6
The
<frame>
tag is used to create one frame, which is simply a window within another window. As an example, if you want three frames (windows) to appear on an HTML page, you must have three
frame
tags and the
frameset
element must set the spacing for three frames.
The
frame
tags can only occur between an opening and closing
frameset
element.
A
frame
element displays content, including forms, images, multimedia, other frames, tables, etc. It is very important to understand that the only way to assign content to a
frame
is to assign a URL using the
src
attribute. Whatever content is displayable at the referenced URL will in turn be displayed inside the
frame
.
The frames can have either a column (vertical) or a row (horizontal) configuration, but not both. The configuration must be set using either the
cols
or the
rows
attribute of the
frameset
tag, but not both. The order of the
frame
tags sets the order of the frames. If they are in a
rows
configuration, the first
frame
element is the top window, the second
frame
element is second from the top, etc. For the
cols
configuration, the order is left to right.
Note that you can nest
frameset
tags inside of
frameset
tags. Therefore, an HTML document can contain numerous frames. This opens the possibility of creating complex and imaginative page displays (however, always remember to keep the page user friendly).
Core Attributes
class
id
style
title
Attributes
frameborder
The
frameborder
attribute is used to add or remove a border around a frame. The value of
yes
or
1
allows a border. The value of
no
or
0
forbids a border.
longdesc
The
longdesc
attribute is the URL address of an HTML document that contains a long textual description of the
frame
. This is designed to provide more information than a
title
element would display.
marginheight
The
marginheight
attribute is used to set the amount of white space in pixels that will appear along the top and bottom margins between the frame border and the contents. If you provide an unrealistic value, the browser will simply ignore this attribute.
marginwidth
The
marginwidth
attribute is used to set the amount of white space in pixels that will appear along the left and right margins between the frame border and the contents. If you provide an unrealistic value, the browser will simply ignore this attribute.
name
The
name
attribute is a string of characters that is used to label a frame with a name. The name must be unique to that document and cannot be reused.
noresize
The
noresize
attribute prevents the user from changing the
frame
size.
scrolling
The
scrolling
attribute is used to determine if horizontal and vertical scrolling bars will appear in the
frame
. If the content is larger than the frame, this permits scrolling up and down or left and right, as needed, to see the entire contents. There are three permitted values:
yes
which always displays scroll bars;
no
which never displays scroll bars; and
auto
which displays scroll bars only when needed. If a value is not provided, the default is
auto
.
src
The
src
attribute provides the URL address of any valid HTML, ASP, or other displayable page. The contents of the referenced URL will be displayed inside the
frame
.
This example creates five frames, each with a different background color. Note that there is no
body
tag.
Code:
<html>
<head>
<title>frames example</title>
</head>
<frameset cols="50%, 50%">
<noframes>
To be viewed properly, this page requires frames.
</noframes>
<frameset rows="33%, 33%, *">
<frame src="html_frames_red.html">
<frame src="html_frames_orange.html">
<frame src="html_frames_yellow.html">
</frameset>
<frameset rows="50%, 50%">
<frame src="html_frames_green.html">
<frame src="html_frames_blue.html">
</frameset>
</frameset>
</html>
Output:
Click here to see the output of this frames example in a separate window.
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information