<iframe>
HTML <iframe> Tag
Instance
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文网(php.cn)</title> </head> <body> <iframe src="//m.sbmmt.com"> <p>您的浏览器不支持 iframe 标签。</p> </iframe> </body> </html>
Run Example»
Click the "Run Instance" button to view the online instance
Browser support
All major browsers support the <iframe> tag.
Tag definition and usage instructions
<iframe> tag specifies an inline frame.
An inline frame is used to embed another document within the current HTML document.
Tips and Notes
Tips:You can place the required text between <iframe> and </iframe>, so that Deals with browsers that don't support <iframe>.
Tip: Use CSS to define styles for <iframe> (including scroll bars).
Differences between HTML 4.01 and HTML5
HTML5 adds some new attributes and removes some attributes in HTML 4.01.
Differences between HTML and XHTML
In XHTML, the name attribute has been deprecated and will be removed. Please use the id attribute instead.
Attribute
New: New attribute in HTML5.
Attributes | Value | Description |
---|---|---|
align | left right top middle Bottom | HTML5 is not supported. HTML 4.01 is deprecated. Specifies how the <iframe> is aligned relative to surrounding elements. |
frameborder | 1 0 | HTML5 is not supported. Specifies whether to display the border around <iframe>. |
height | pixels | Specifies the height of <iframe>. |
longdesc | URL | ##HTML5 Not supported. Specifies a page that contains a longer description of the <iframe>. |
pixels | ##HTML5 Not supported.Specifies the top and bottom margins of <iframe>. | |
pixels | HTML5 Not supported. | Specifies the left and right margins of <iframe>. |
name | Specifies the name of <iframe>. | |
"" | Allow-forms
Allow-same-origin Allow-scripts Allow-top-navigation Defines a series of additional restrictions on the content of <iframe>. | |
yes | No
auto | HTML5 is not supported. Specifies whether to display scroll bars in <iframe>. |
seamless | Specifies that <iframe> appears as part of the parent document. | |
URL | Specifies the URL of the document to be displayed within an <iframe>. | |
HTML_code | Specifies that the HTML content in the page is displayed in <iframe> ; middle. | |
pixels | Specifies the width of <iframe>. |
Global attributes
The<iframe> tag supports global attributes of HTML.
Event attributes<iframe> tag supports HTML event attributes.
Related ArticlesHTML Tutorial: HTML Framework
HTML DOM Reference Manual: IFrame Object