NOTICE: This website is no longer updated or supported - as such many of the techniques used to build it may seem antiquated in the modern day. It is preserved for historical reasons only.

HTML XHTML The Complete Reference
home » reference » appendix a » html element reference

<frame> (Window Region)


This element defines a nameable window region, known as a frame, that can independently display its own content.

Standard Syntax


<frame
class="class name(s)"
frameborder="0 | 1"
id="unique alphanumeric identifier"
longdesc="url of description"
marginheight="pixels"
marginwidth="pixels"
name="frame name"
noresize="noresize"
scrolling="auto | no | yes"
src="url" of frame contents
style="style information"
title="advisory text"
>

Attributes Defined by Internet Explorer


allowtransparency="no | yes" (5.5)
application="no | yes" (5)
bordercolor="color name | #RRGGBB" (4)
datafld="name of column supplying bound data" (4)
datasrc="id of data source object supplying data" (4)
frameborder="no | yes | 0 | 1" (4)
height="pixels" (4)
hidefocus="true | false" (5.5)
lang="language code" (4)
language="javascript | jscript | vbs | vbscript" (4)
security="restricted" (6)
tabindex="number" (5.5)
unselectable="on | off" (5.5)
width="pixels" (4)

Events Defined by Internet Explorer


onactivate, onafterupdate, onbeforedeactivate, onbeforeupdate, onblur, oncontrolselect, ondeactivate, onerrorupdate, onfocus, onload, onmove, onmoveend, onmovestart, onresize, onresizeend, onresizestart

Element Specific Attributes


allowtransparency
This Internet Explorer–specific attribute determines whether the <frame> is transparent or opaque. The default value is false, which means it is opaque.
application
This Microsoft-specific attribute is used to indicate whether the content of an <frame> is to be considered an HTA application. HTA applications are applications that use HTML, JavaScript, and Internet Explorer, but are not limited to the typical type of security considerations of a Web page. Given its security implications, this attribute should only be set if the developer is familiar with HTAs.
bordercolor
This attribute sets the color of the frame's border using either a named color or a color specified in the hexadecimal #RRGGBB format.

datafld
This Internet Explorer attribute specifies the column name from the data source object that supplies the bound data.

datasrc
This Internet Explorer attribute indicates the id of the data source object that supplies the data that is bound to this element.

frameborder
This attribute determines whether the frame is surrounded by an outlined three-dimensional border. The HTML specification prefers the use of 1 for the frame border on and 0 for off; most browsers also acknowledge the use of no and yes.

longdesc
This attribute specifies a URL of a document that contains a long description of the frame's content. This attribute should be used in conjunction with the <title> element.

marginheight
This attribute sets the height in pixels between the frame's contents and its top and bottom borders.

marginwidth
This attribute sets the width in pixels between the frame's contents and its left and right borders.

name
This attribute assigns the frame a name so that it can be the target destination of hyperlinks as well as being a possible candidate for manipulation via a script.

noresize
This attribute overrides the default ability to resize frames and gives the frame a fixed size.

scrolling
This attribute determines if the frame has scroll bars. A yes value forces scroll bars, a no value prohibits them, and an auto value lets the browser decide. When not specified, the default value of auto is used. Authors are recommended to leave the value as auto. If you turn off scrolling and the contents end up being too large for the frame (due to rendering differences, window size, and so forth), the user will not be able to scroll to see the rest of the contents. If you turn scrolling on and the contents all fit in the frame, the scroll bars will needlessly consume screen space. With the auto value, scroll bars appear only when needed.

security
This attribute sets the value indicating whether the source file of a frame has security restrictions applied. The only allowed value is restricted.
src
This attribute contains the URL of the contents to be displayed in the frame. If absent, nothing will be loaded in the frame.

Example


<frameset rows="20%,80%">
  <frame src="controls.htm" name="controls"
    noresize scrolling="no">
  <frame src="content.htm">
</frameset>

XHTML Example


<frameset rows="20%,80%">
   <frame src="controls.htm" name="controls"
noresize scrolling="no" />
   <frame src="content.htm" />
</frameset>

Compatibility


HTML 4, 4.01, XHTML 1.0 (frameset DTD only)
Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 2, 3, 4, 4.5-4.8, 6, 7
Opera 4-7

Notes


XHTML 1.0 requires a trailing slash for this element: <frame />.

A frame must be declared as part of a frame set by using the <frameset> tag, which specifies the frame's relationship to other frames on a page. A frame set occurs in a special HTML document, in which the frameset element replaces the body element.

Another form of frames called independent frames, or floating frames, also is supported. Floating frames can be directly embedded in a document without belonging to a frame set. These are defined with the iframe element.

Many browsers do not support frames and require the use of the <noframes< tag.

Frames introduce potential navigation difficulties; their use should be limited to instances in which they can be shown to help navigation rather than hinder it. See Chapter 8 for more details.

(X)HTML Elements
CSS Properties
Previous: form Next: frameset
< Home | About | Chapters | Examples | Errata | Reference | Site Map >