Webpage Workshop: Home » XHTML 1.0 language reference » Inline frame

Inline frame (transitional only)

<iframe
    align="bottom | left | middle | right | top"**
    class="class name(s)"**
    frameborder="0 | 1"**
    height="% | pixels"**
    id="unique identifier"**
    longdesc="url"**
    marginheight="pixels"**
    marginwidth="pixels"**
    name="identifier"**
    scrolling="auto | no | yes"**
    src="url"**
    style="style information"**
    title="text"**
    width="% | pixels"**
>
</iframe>

Key:
‡ = Required attribute
** = Transitional only

Explanation of attributes

align**: used to specify the horizontal alignment of the element with respect to the page. The default value is "left".

class**: used to state which class(es) the element belongs to. It is possible to indicate more than one class for an element by separating each class name with a space character. This attribute is normally used in combination with a stylesheet in order to associate the elements with particular styles defined within the stylesheet.

frameborder**: used to specify whether or not the frame should be surrounded by a border. The value 1 sets the frame to on, whereas 0 sets it to off. The default value is 1.

height**: used to specify the height of the inline frame as either a percentage or fixed pixel value.

id**: used to specify a unique alphanumeric identifier to the element. This is usually used in combination with stylesheets in order to apply a style to one particular instance of an element. Only one element, regardless of type, can be given a particular id.

longdesc**: this is used to indicate the URL of a webpage containing a long description of the content of the frame. This should be used in conjunction with the title attribute.

marginheight**: used to set the distance in pixels between the content of the frame and its top and bottom borders.

marginwidth**: used to set the distance in pixels between the content of the frame and its left and right borders.

name**: used to identify the frame amongst other frames. This is how frames are identified in links when opening a page in a specified frame.

scrolling**: used to specify whether a frame should be scrollable or not. The possible values are: yes, no and auto. 'yes' means that scrollbars will always be present whether they are required or not, whereas 'no' prohibits scrolling even if it is in fact required. The value 'auto' means that the browser chooses whether scrollbars are required or not and only inserts them in cases where they are.

src**: this attribute is used to specify the source URL of the resource to be displayed within the frame. Where this attribute is not supplied the frame will simply be left empty.

style**: used to specify an inline style to apply to the element. The styles defined here override the styles declared in the header section.

title**: used to define an advisory text that may be displayed as a tooltip when a mouse is used to hover over the element.

width**: used to specify the width of the inline frame as either a percentage or fixed pixel value.

Event handlers

No event handlers are defined for this element.

Compatibility

Description: Support of inline frame and attributes in various browsers
Test Internet Explorer 6+ Netscape 4 Mozilla and Netscape 6+ Opera 6+ MSN TV (WebTV) Konqeuror 3.0+
Basic element support  Yes  No  Yes  Yes  No  Yes 
Attribute: align  Yes  No  Yes  Yes  No  Yes 
Attribute: class  Yes  No  Yes  Yes  No  Yes 
Attribute: frameborder  Yes  No  Yes  Yes  No  Yes 
Attribute: height  Yes  No  Yes  Yes  No  Yes 
Attribute: id  Yes  No  Yes  Yes  No  Yes 
Attribute: longdesc  No  No  No  No  No  No 
Attribute: marginheight  Yes  No  Yes  Yes  No 
Attribute: marginwidth  Yes  No  Yes  Yes  No 
Attribute: name  Yes  No  Yes  Yes  No  Yes 
Attribute: scrolling  Yes  No  Yes  Yes  No  Yes 
Attribute: src  Yes  No  Yes  Yes  No  Yes 
Attribute: style  Yes  No  Yes  Yes  No 
Attribute: title  Yes  No  Yes  Yes  No  Yes 
Attribute: width  Yes  No  Yes  Yes  No  Yes 

Key:
The browser icons are explained in the below list:
Internet Explorer 6+ = Microsoft Internet Explorer 6+
Netscape 4 = Netscape Communicator 4
Mozilla and Netscape 6+ = Mozilla and Netscape Navigator 6+
Opera 7+ = Opera 7+
MSN TV (WebTV) = MSN TV (aka. WebTV)
Konqeuror 3.0+ = Konqueror 3.0+