<FRAME> | NN 2 IE 3 HTML 4
<FRAME> | HTML End Tag: Forbidden
The frame element defines properties of an individual window space that is some fractional portion of the entire browser window. A frame element must be defined within the context of a frameset element. It is the frameset that defines the row and column arrangement of a related group of frames.

A browser treats a frame as a separate browser window within the browser application's window. As such, each frame window can load its own content, independent of other frames. Although no attributes of the frame element are required, assigning a value to the name attribute is highly recommended if you have forms or links whose returned or destination document is to be displayed in a different frame. Scripting among multiple frames also benefits greatly from names assigned to frames because it makes references to those frames (and their contents) more easily understandable to someone reading the script code. Note that among recent W3C DTDs, the frame element validates only in the HTML 4.01 Transitional DTD and the Frameset DTDs for both HTML 4.01 and XHTML 1.0. See Appendix E.

Example
    <FRAMESET cols="150,*">
        <FRAME name="navbar" src="nav.html">
        <FRAME name="main" src="page1.html">
    </FRAMESET>
Object Model Reference
    [window.]frameName
    [window.]frames[i]
    [window.]document.getElementById(elementID)
Element-Specific Attributes

allowtransparency | bordercolor | datafld | datasrc
frameborder | height | longdesc | marginheight
marginwidth | name | noresize | scrolling
security | src | width |

Element-Specific Event Handler Attributes
None.

allowtransparency | NN n/a IE 5.5 HTML n/a
allowtransparency="featureSwitch" | Optional
More applicable to the iframe element, the allowtransparency attribute, when engaged, turns the frame's background transparent. See the iframe element.

bordercolor | NN 3 IE 4 HTML n/a
bordercolor="colorTripletOrName" | Optional
If your frameset displays borders (as set with the border attribute of the frameset element), but you want a subset of the frames in the frameset to be rendered with a border color different from the rest, you can assign a color to the bordercolor attribute of an individual frame element. Mixing border colors in a frameset exposes your HTML to the risk of different rendering techniques of each browser and operating system. Not only do the precise pixel composition of borders vary, but each browser and operating system may resolve conflicts between colored borders differently. If you assign a color to only some frames of a frameset, be sure to test the look on as many browser versions and operating systems as possible to evaluate the visual effect of your color choices. IE 6 for Windows ignores this attribute.
Example
    <FRAME name="navbar" src="nav.html" bordercolor="salmon">
Value
A hexadecimal triplet or plain-language color name. See Appendix A for acceptable plain-language color names.
Default
None.
Object Model Reference
    [window.]document.getElementById(elementID).borderColor

datafld | NN n/a IE 4 HTML n/a
datafld="columnName" | Optional
Used with IE data binding to associate a remote data source column name in lieu of an src attribute for a frame element. The data source column must contain a valid URI (relative or absolute). A datasrc attribute must also be set for the element. Works only with text file data sources in IE 5/Mac.
Example
    <FRAME datasrc="DBSRC3" datafld="newsURL">
Value
Case-sensitive identifier.
Default
None.
Object Model Reference
    [window.]document.getElementById(elementID).dataFld

datasrc | NN n/a IE 4 HTML n/a
datasrc="dataSourceName" | Optional
Used with IE data binding to specify the ID of the page's object element that loads the data source object for remote data access. Content from the data source is specified via the datafld attribute. Works only with text file data sources in IE 5/Mac.
Example
    <FRAME datasrc="DBSRC3" datafld="newsURL">
Value
Case-sensitive identifier.
Default
None.
Object Model Reference
    [window.]document.getElementById(elementID).dataSrc

frameborder | NN 3 IE 3 HTML 4
frameborder="borderSwitch" | Optional
Controls whether an individual frame within a frameset displays a border. The setting is supposed to override the frameborder attribute setting of the containing frameset element. Controlling individual frame borders appears to be a problem for most browsers in most operating system versions. Turning off the border of one frame may have no effect if all adjacent frames have their borders on. Feel free to experiment with the effects of turning some borders on and some borders off, but be sure to test the final effect on all browsers and operating systems used by your audience. You can rely more comfortably on the frameborder attribute of the entire frameset.
Example
    <FRAME name="navbar" src="nav.html" frameborder="0">
Value
On-off values for this attribute vary with the source. HTML 4 specifies the values of 1 (on) and 0 (off). Navigator 3 and 4 use yes and no. Internet Explorer 4 and later and Netscape 6 accept both sets of values.
Default
1
Object Model Reference
    [window.]document.getElementById(elementID).frameBorder

height, width | NN n/a IE 4 HTML n/a
height="length" width="length" | Optional
Microsoft HTML documentation for IE says that the height and width attributes control the size of a frame. In practice in IE, these attributes have no direct control over the appearance of the frames within a frameset. Instead, the cols and rows attributes of the containing frameset govern the initial geometry of a frame. Do not use these attributes.

longdesc | NN 6 IE6 HTML 4
longdesc="URL" | Optional
Specifies a URL of a document that contains a longer description of the element than what the content of the title attribute reveals. One application of this attribute in future browsers is to retrieve an annotated description of the element for users who cannot read the browser screen. The Properties choice for Netscape 6's context menu for this element displays a small window that includes an active link to the URL assigned to the attribute. Version 6 browsers provide no other functionality for this attribute.
Example
    <FRAME longdesc="navDesc.html" title="Navigation Bar" src="navbar.html">
Value
Any valid URI, including complete and relative URLs.
Default
None.
Object Model Reference
    [window.]document.getElementById(elementID).longDesc

marginheight, marginwidth | NN 6 IE 3 HTML 4
marginheight="pixelCount" marginwidth="pixelCount" | Optional
The number of pixels between the inner edge of a frame and the content rendered inside the frame. The marginheight attribute controls space along the top and (when scrolled) the bottom edges of a frame; the marginwidth attribute controls space on the left and right edges of a frame. The HTML 4 specification leaves default behavior up to browsers.

Without any prompting, Internet Explorer automatically inserts a margin of 14 (Windows) or 8 (Macintosh) pixels inside a frame. But if you attempt to override the default behavior, be aware that setting any one of these two attributes causes the value of the other to go to zero. Therefore, unless you want the content to be absolutely flush with various frame edges, you need to assign values to both attributes.

Example
    <FRAME src="navbar.html" marginheight="20" marginwidth="14">
Value
Any positive integer value or zero.
Default
14 (IE/Windows) or 8 (IE/Macintosh).
Object Model Reference
    [window.]document.getElementById(elementID).marginHeight
    [window.]document.getElementById(elementID).marginWidth

name | NN 2 IE 3 HTML 4
name="elementIdentifier" | Optional
When links and forms must load their destination or returned documents into frames other than the one holding the link or form, those elements have target attributes indicating which frame receives the new content. To direct such content to a frame, the frame must have a value assigned to its name attribute. That same value is assigned to the target attribute of the a or form element. Client-side scripting also uses the frame's name in building references to other frames or content in other frames. It is good practice to assign a unique identifying name to all frames.

The name attribute is deprecated in XHTML. To validate under the Frameset XHTML DTD, assign the same identifier to the element's name and id attributes.

Example
    <FRAME name="navbar" id="navbar" src="nav.html">
Value
Case-sensitive identifier.
Default
None.
Object Model Reference
    [window.]frameName.name
    [window.]frames[i].name
    [window.]document.getElementById(elementID).name

noresize | NN 2 IE 3 HTML 4
noresize | Optional
Frame borders can be resized by the user dragging the border perpendicular to the axis of the border edge. When present, the noresize attribute instructs the browser to prevent the frame's edges from being manually resized by the user. All border edges of the affected frame element become locked, meaning that all edges that extend to other frames in the frameset remain locked as well.
Example
    <FRAME src="navbar.html" noresize>
Value
The presence of the attribute in HTML makes the frame nonresizable.
Default
Frames are resizable by default.
Object Model Reference
    [window.]document.getElementById(elementID).noResize

scrolling | NN 2 IE 3 HTML 4
scrolling="auto" | "no" | "yes" | Optional
By default, browsers add vertical and/or horizontal scrollbars when the content loaded into a frame exceeds the visible content region of the frame. Scrollbars can affect the layout of some content because they occupy space normally devoted to content (that is, the frame does not expand to accommodate scrollbars). Also, due to differences in default font sizes in browsers and operating system versions, a given collection of text content may display differently in different clients. If you want to prevent scrollbars from appearing in the frame, set the scrolling attribute to no; if you want scrollbars to be in the frame at all times, set the attribute to yes. In the latter case, if the content does not require scrolling, the scrollbars are disabled. In some older versions of Navigator, the automatic scrollbars remain visible, even if content not requiring them is subsequently loaded into a frame. In Navigator 4 and later and all versions of Internet Explorer, the automatic scrollbars appear only when needed.

Setting the scrolling attribute to no should be used only after you have tested on all browsers and platforms that mission-critical content is always visible in the frame. If the frame is set to not scroll and has the noresize attribute set, some users might not be able to see all the content of the frame.

Example
    <FRAME src="navbar.html" scrolling="no">
Value
Constant values: auto | no | yes.
Default
auto
Object Model Reference
    [window.]document.getElementById(elementID).scrolling

security | NN n/a IE 6 HTML n/a
security="restricted" | Optional
When activated, this attribute raises the security level of the frame to the Restricted level of the Windows Security preferences settings. Such a frame's content may not execute scripts.
Example
    <FRAME src="navbar.html" security="restricted">
Value
Constant value: restricted.
Default
None.

src | NN 2 IE 3 HTML 4
src="URL" | Optional
Defines the URL of the content to be loaded into the frame element. The URL can be an absolute URL or one relative to the URL of the document containing the frameset specifications. You may also use the javascript: pseudo-URL to have the returned value of a script appear in the frame. For example, if you want a frame to be blank when the frameset loads, you can define a function in the frameset document that returns a blank HTML page. The src attribute for each soon-to-be blank frame invokes the function from the vantage point of the child frame:

Another type of blank page is available from some browsers and versions via the about:blank URL, which draws from an internal blank page. However, Navigator 2 and 3 for the Macintosh display an unwanted message with this URL in a window or frame.

Example
    <FRAME src="navbar.html">
Value
A complete or relative URL or a javascript: pseudo-URL.
Default
None.
Object Model Reference
    [window.]document.getElementById(elementID).src

width |
See height.