<embed>:外部内容嵌入元素
HTML <embed>
元素将外部内容嵌入文档中的指定位置。此内容由外部应用程序或其他交互式内容源(如浏览器插件)提供。
备注:这篇文档仅定义该元素在 HTML5 中定义的部分,不包含该元素之前的声明内容和非标准的实现。
请记住,大多数现代浏览器已经弃用并取消了对浏览器插件的支持,所以如果您希望您的网站可以在普通用户的浏览器上运行,那么依靠 <embed>
通常是不明智的。
Content categories | Flow content, phrasing content, embedded content, interactive content, palpable content. |
---|---|
Permitted content | None, it is an empty element. |
Tag omission | Must have a start tag, and must not have an end tag. |
Permitted parents | Any element that accepts embedded content. |
Permitted ARIA roles | application , document , img , presentation |
DOM interface | HTMLEmbedElement (en-US) |
属性
这个元素的属性包括 全局属性。
height
- 资源显示的高度,in CSS pixels. -- (Absolute values only. NO percentages)
src
- 被嵌套的资源的 URL。
type
- 用于选择插件实例化的 MIME 类型。
width
- 资源显示的宽度,in CSS pixels. -- (Absolute values only. NO percentages)
例子
<embed type="video/quicktime" src="movie.mov" width="640" height="480">
规范
规范 | 状态 | 备注 |
---|---|---|
HTML Living Standard <embed> |
Living Standard | |
HTML5 <embed> |
Recommendation |
浏览器兼容性
BCD tables only load in the browser
注意: 不同浏览器之间显示有差异。Blink 内核浏览器(Chrome,Opera)会显示 HTML 资源的内容,但 Firefox 会显示一条通知消息,指出内容需要一个插件(见 bug 730768)。建议使用 <object> 或 <iframe> 元素。