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

<iframe> (Floating Frame)

This element indicates a floating frame, an independently controllable content region that can be embedded in a page.

Standard Syntax (Transitional and Frameset Only)

align="bottom | left | middle | right | top"
class="class name(s)"
dir="ltr | rtl"
frameborder="1 | 0"
height="percentage | pixels"
id="unique alphanumeric identifier"
lang="language code"
longdesc="url of description"
scrolling="auto | no | yes"
src="url of frame contents"
style="style information"
title="advisory text"
width="percentage | pixels"

Attributes Defined by Internet Explorer 4

allowtransparency="false | true" (5.5)
application="yes" (5)
border="pixels" (4)
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)
hidefocus="true | false" (5.5)
hspace="pixels" (4)
language="javascript | jscript | vbs | vbscript" (4)
security="restricted" (6)
tabindex="number" (5.5)
unselectable="on | off" (5.5)
vspace="pixels" (4)

Standard Event Attributes

onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup

Events Defined by Internet Explorer

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

Element Specific Attributes

This attribute controls the horizontal alignment of the floating frame with respect to the page. The default is left.

This Internet Explorer–specific attribute determines whether the <iframe> is transparent or opaque. The default value is false, which means it is opaque.

This Microsoft-specific attribute is used to indicate whether the contents of an <iframe> are 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.
This attribute specifies the thickness of the border in pixels.

This attribute specifies the color of the border.

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

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

This attribute determines whether the frame is surrounded by a border. The HTML 4 specification defines 0 to be off and 1 to be on. The default value is 1. Internet Explorer also defines the values no and yes.

This attribute creates additional space between the frames.

The attribute sets the floating frame's height in pixels.

This attribute specifies margins for the frame.

This attribute specifies a URL of a document which contains a long description of the frame's contents. This might be particularly useful as a complement to the <title> element.

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

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

This attribute assigns the floating frame a name so that it can be the target destination of hyperlinks.

This attribute determines if the frame has scroll bars. A yes value forces scroll bars; a no value prohibits them.

This attribute sets the value indicating whether the source file of an iframe has security restrictions applied. The only allowed value is restricted.
This attribute contains the URL of the content to be displayed in the floating frame. If absent, the frame is blank.

This attribute specifies margins for the frame.

This attribute sets the floating frame's width in pixels.


<iframe src="" height="150"
   width="200" name="FloatingFrame1">

Sorry, your browser doesn't support inline frames.


HTML 4 (transitional)
XHTML 1.0 (transitional or frameset)
Internet Explorer 3, 4, 5, 5.5, 6
Netscape 6, 7
Opera 5-7


Under the HTML 4 strict specification, the iframe element is not defined. However, under XHTML transitional and XHTML frameset, iframe is allowed. XHTML 1.1 does not allow it either. Floating frames can be somewhat imitated using the div element and CSS positioning facilities.

When a browser does not understand an <iframe> tag, it displays the text included within it as an alternate rendering.

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