HTML <iframe>Tag
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the <iframe> tag.
Definition and Usage
The <iframe> tag specifies an inline frame.
An inline frame is used to embed another document within the current HTML document.
Tips and Notes
Tip:You can place the required text between <iframe> and </iframe> to accommodate browsers that do not support <iframe>.
Tip:Use CSS to style the <iframe> (including scrollbars).
Differences between HTML 4.01 and HTML5
HTML5 added some new attributes, and removed some attributes from HTML 4.01.
Differences between HTML and XHTML
In XHTML, the name attribute is deprecated and will be removed. Use the id attribute instead.
Attributes
New: New in HTML5.
| Attribute | Value | Description |
|---|---|---|
| align | left right top middle bottom |
Not supported in HTML5. Deprecated in HTML 4.01.Defines how to align the <iframe> according to surrounding elements. |
| frameborder | 1 0 |
Not supported in HTML5.Defines whether to display a border around the <iframe>. |
| height | pixels | Defines the height of the <iframe>. |
| longdesc | URL | Not supported in HTML5.Defines a page that contains a lengthy description of the <iframe>. |
| marginheight | pixels | Not supported in HTML5.Defines the top and bottom margins of the <iframe>. |
| marginwidth | pixels | Not supported in HTML5.Defines the left and right margins of the <iframe>. |
| name | name | Defines the name of the <iframe>. |
| sandboxNew | "" allow-forms allow-same-origin allow-scripts allow-top-navigation |
Defines a set of additional restrictions on the content of the <iframe>. |
| scrolling | yes no auto |
Not supported in HTML5.Defines whether to display scrollbars in the <iframe>. |
| seamlessNew | seamless | Defines that the <iframe> looks like part of the parent document. |
| src | URL | Defines the URL of the document to display in the <iframe>. |
| srcdocNew | HTML_code | Defines the HTML content of the page to display in the <iframe>. |
| width | pixels | Defines the width of the <iframe>. |
Global Attributes
The <iframe> tag supportsthe HTML Global Attributes。
Event Attributes
The <iframe> tag supportsthe HTML Event Attributes。
Related Articles
HTML Tutorial:HTML Frames
HTML DOM Reference:IFrame Object
Other Extensions