Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

HTML <iframe> tags


May 04, 2021 HTML Reference Manual


Table of contents


HTML slt;iframe.gt; tags

The label creates an inline framework that contains another document, effectively embedding another HTML page into the current page. Refer to the following example:

Mark an inline frame:

<iframe src="//www.w3cschool.cn"></iframe>

Try it out . . .

Browser support

HTML <iframe> tags HTML <iframe> tags HTML <iframe> tags HTML <iframe> tags HTML <iframe> tags

All major browsers support the hashtags.


Label definition and instructions for use

The label specifies an inline framework.

One inline framework is used to embed another document in the current HTML document.


Tips and comments

Tip: You can place the text you want between the slt; iframe and slt;/iframe sgt; so that you can handle browsers that don't support the slt; iframe.

Tip: Use CSS to define styles for slt;iframe,including scroll bars.

Tip: Tags are primarily used for common parts of multiple pages, such as navigation bars, ad columns, and so on.


The difference between HTML 4.01 and HTML5

HTML5 has added some new properties and removed some of the properties from HTML 4.01.


The difference between HTML and XHTML

In XHTML, the name property is discarded and will be removed. Use the id property instead.


Property

New : The new property in HTML5.

属性 描述
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> 的宽度。


Global properties

The label supports the global properties of HTML.


The event property

The tag supports the event properties of HTML.


Related articles

HTML tutorial: HTML framework

HTML DOM Reference Manual: IFrame Object