HTML 4 iframe Tag

Also see HTML5 <iframe> Tag.

This page is for the HTML 4 version of this element. For a more up to date version, see HTML5 <iframe> Tag.


The HTML iframe tag is used to specify an inline frame.

An inline frame allows you to embed another document within the current HTML document. You use the iframe src attribute to specify the source of the other document, as well as other attributes to determine the height, width, scrolling properties, border etc.

Example

The above code produces the following inline frame:

Attributes

Attributes specific to this tag:
AttributeDescription
nameAssigns a name to a frame. This is useful for loading contents into one frame from another.
longdescA long description - this can elaborate on a shorter description specified with the title attribute.
widthSpecifies the width of the inline frame.
heightSpecifies the height of the inline frame.
Other Attributes:
AttributeDescription
classDocument wide identifier.
idDocument wide identifier
titleSpecifies a title to associate with the element. Many browsers will display this when the cursor hovers over the element (similar to a "tool tip").
styleInline style (CSS)
srcLocation of the frame contents (for example, the HTML page to be loaded into the frame).
scrollingWhether the frame should be scrollable or not (i.e. should scrollbars appear). Possible values:
  • auto: This value means that scrollbars should appear on the frame, only if the contents of the framed page are too big to fit inside the frame
  • yes: Scrollbars should always appear on the frame, regardless of the size of its contents
  • no: Scrollbars should not appear, even if the contents are too big for the frame
frameborderWhether the frame should have a border or not. Possible values:
  • 1: The frame should have a border
  • 0: The frame should not have a border
marginwidthSpecifies the margin, in pixels, between the frame's contents and it's left and right margins.
marginheightSpecifies the margin, in pixels, between the frame's contents and it's top and bottom margins.
alignFor alignment. Possible values:
  • left: Text is rendered flush left
  • center: Text is centered
  • right: Text is rendered flush right
  • justify: Text is justified to both margins

HTML5 Tags

The information on this page is based on HTML version 4.01. Most modern browsers now support HTML5.

See HTML5 <iframe> Tag for the HTML5 version of the above element.

See this list of HTML tags for the latest list of HTML elements.