Tag Description
The iframe tag is used to define an inline frame that contains another document.
This tag has the form:
<iframe
align="{ bottom | left | middle | right | top }"
frameborder="{ 0 | 1 }"
height="height"
longdesc="URL"
marginheight="pixels"
marginwidth="pixels"
name="name"
noresize="noresize"
scrolling="{ auto | no | yes}"
src="URL"
width="width">
</iframe>
HTML5 and HTML4.01 Differences
HTML5 has defined new attributes, and some HTML4.01 attributes are not supported in HTML5.
HTML5 | = New for HTML5 |
Attributes
Attribute | Value | Description |
---|---|---|
align | left right top middle bottom |
Specifies the alignment of an iframe according to surrounding elements
HTML4:
![]()
HTML5:
![]() |
frameborder | 0 1 |
Specifies whether or not to display a border around an iframe
HTML4:
![]()
HTML5:
![]() |
height | pixels % |
Specifies the height of an iframe |
longdesc | URL | Specifies a page that contains a long description of the content of an iframe
HTML4:
![]()
HTML5:
![]() |
marginheight | pixels | Specifies the top and bottom margins of an iframe
HTML4:
![]()
HTML5:
![]() |
marginwidth | pixels | Specifies the left and right margins of an iframe
HTML4:
![]()
HTML5:
![]() |
name | name | Specifies the name of the iframe |
sandboxHTML5 | allow-forms allow-same-origin allow-scripts allow-top-navigation |
Specifies restrictions to the frame content. |
scrolling | yes no auto |
Specifies whether or not to display scrollbars in an iframe
HTML4:
![]()
HTML5:
![]() |
seemlessHTML5 | seemless | If present, the iframe should appear as if it is part of the document the iframe is in |
src | URL | Specifies the URL of the document to show in an iframe |
srcdocHTML5 | HTML | The HTML of the document showing in the iframe |
width | pixels % |
Specifies the width of an iframe |
Global Attributes
This tag also supports the HTML Global Attributes.
Event Attributes
This tag also supports the HTML Event Attributes.
Browser Support
Firefox | IE | Chrome | Opera | Safari |
---|---|---|---|---|
Doctype Declaration Support
The following table lists the doctype declarations this element may appear in:
HTML4.01 / XHTML1.0 | XHTML 1.1 | HTML 5 | ||
---|---|---|---|---|
Traditional | Strict | Frameset | ||
Miscellaneous Information
Defined In: | HTML4 |
---|---|
Empty Tag: | No |