Easy Tutorial
❮ Att Link Href Html Head ❯

HTML <iframe> Tag

Example

Mark up an inline frame:


Browser Support

All major browsers support the <iframe> tag.


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 any required text between the <iframe> and </iframe> tags to cater to browsers that do not support iframes.

Tip: Use CSS to define the style for the <iframe> (including scrollbars).


Differences Between HTML 4.01 and HTML5

HTML5 introduced 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

Attribute Value Description
align left <br>right <br>top <br>middle <br>bottom Not supported in HTML5. Deprecated in HTML 4.01. Specifies the alignment of the <iframe> relative to the surrounding elements.
frameborder 1 <br>0 Not supported in HTML5. Specifies whether to display a border around the <iframe>.
height pixels Specifies the height of the <iframe>.
longdesc URL Not supported in HTML5. Specifies a page that contains a long description of the content of the <iframe>.
marginheight pixels Not supported in HTML5. Specifies the top and bottom margins of the content of the <iframe>.
marginwidth pixels Not supported in HTML5. Specifies the left and right margins of the content of the <iframe>.
name name Specifies the name of the <iframe>.
sandbox New "" <br>allow-forms <br>allow-same-origin <br>allow-scripts <br>allow-top-navigation Applies extra restrictions to the content in the <iframe>.
scrolling yes <br>no <br>auto Not supported in HTML5. Specifies whether or not to display scrollbars in the <iframe>.
seamless New seamless Specifies that the <iframe> should look like part of the parent document.
src URL Specifies the URL of the document to embed in the <iframe>.
srcdoc New HTML_code Specifies the HTML content of the page to show in the <iframe>.
width pixels Specifies the width of the <iframe>.

Global Attributes

The <iframe> tag supports HTML's global attributes.


Event Attributes

The <iframe> tag supports HTML's event attributes.


Related Articles

HTML Tutorial: HTML Frames

HTML DOM Reference: IFrame Object

❮ Att Link Href Html Head ❯