The best HTML <iframe> tag Tutorial In 2024, In this tutorial you can learn Examples,Browser Support,Tag definitions and instructions,Tips and Notes,Differences between HTML 4.01 and HTML5,Differences between HTML and XHTML,Attributes,Global Properties,Event Properties,related articles,
Mark an inline frame:
All major browsers support the <iframe> tag.
<Iframe> tag specified an inline frame.
An inline frame is used in the current HTML document embedded in another document.
Tip: You can put the text needs to be placed in the <iframe> and </ iframe> between, so that you can cope without support <iframe> browser.
Tip: Use CSS for the <iframe> (including the scroll bar) define the style.
HTML5 adds some new properties, and removed some HTML 4.01 attributes.
In XHTML, name attribute is deprecated and will be removed. Please use the id attribute instead.
New: HTML5 new property.
属性 | 值 | 描述 |
---|---|---|
align | left right top middle bottom |
HTML5 不支持。HTML 4.01 已废弃。 规定如何根据周围的元素来对齐 <iframe>。 |
frameborder | 1 0 |
HTML5 不支持。规定是否显示 <iframe> 周围的边框。 |
height | pixels | 规定 <iframe> 的高度。 |
longdesc | URL | HTML5 不支持。规定一个页面,该页面包含了有关 <iframe> 的较长描述。 |
marginheight | pixels | HTML5 不支持。规定 <iframe> 的顶部和底部的边距。 |
marginwidth | pixels | HTML5 不支持。规定 <iframe> 的左侧和右侧的边距。 |
name | name | 规定 <iframe> 的名称。 |
sandbox New | "" allow-forms allow-same-origin allow-scripts allow-top-navigation |
对 <iframe> 的内容定义一系列额外的限制。 |
scrolling | yes no auto |
HTML5 不支持。规定是否在 <iframe> 中显示滚动条。 |
seamless New | seamless | 规定 <iframe> 看起来像是父文档中的一部分。 |
src | URL | 规定在 <iframe> 中显示的文档的 URL。 |
srcdoc New | HTML_code | 规定页面中的 HTML 内容显示在 <iframe> 中。 |
width | pixels | 规定 <iframe> 的宽度。 |
<iframe> tag supports HTML global properties .
<iframe> tag supports HTML event properties .
HTML Tutorial: HTML frame
HTML DOM Reference Manual: the IFrame objects