HTML iframe Tag

HTML <iframe> Tag

Example

An inline frame is marked up as follows:

<iframe src="html_intro.asp" width="100%" height="300">
  <p>Your browser does not support iframes.</p>
</iframe>

Try it yourself »

Definition and Usage

The <iframe> tag defines an inline frame that contains another document.


Browser Support

The <iframe> tag is supported in all major browsers.


Differences Between HTML and XHTML

In XHTML, the name attribute of the <iframe> tag is deprecated, and will be removed. Use the id attribute instead.


Tips and Notes

Tip: To deal with browsers that do not understand iframes, place the text you want between the opening <iframe> tag and the closing </iframe> tag.


Optional Attributes

DTD indicates in which HTML 4.01/XHTML 1.0 DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.

AttributeValueDescriptionDTD
alignleft
right
top
middle
bottom
Deprecated. Use styles instead.
Specifies the alignment of an iframe according to surrounding elements
TF
frameborder1
0
Specifies whether or not to display a border around an iframeTF
heightpixels
%
Specifies the height of an iframeTF
longdescURLSpecifies a page that contains a long description of the content of an iframeTF
marginheightpixelsSpecifies the top and bottom margins of an iframeTF
marginwidthpixelsSpecifies the left and right margins of an iframeTF
namenameSpecifies the name of an iframeTF
scrollingyes
no
auto
Specifies whether or not to display scrollbars in an iframeTF
srcURLSpecifies the URL of the document to show in an iframeTF
widthpixels
%
Specifies the width of an iframeTF


Standard Attributes

The <iframe> tag supports the following standard attributes:

AttributeValueDescriptionDTD
classclassnameSpecifies a classname for an elementTF
ididSpecifies a unique id for an elementTF
stylestyle_definitionSpecifies an inline style for an elementTF
titletextSpecifies extra information about an elementTF

More information about Standard Attributes.


Event Attributes

According to the W3C, the <iframe> tag does not support any event attributes.

However, the onload event is supported in all browsers.

More information about Event Attributes.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值