HTML <embed> 元素将外部内容嵌入文档中的指定位置。此内容由外部应用程序或其他交互式内容源(如浏览器插件)提供。

Note: 这篇文档仅定义该元素在 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

属性

这个元素的属性包括 全局属性

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  

浏览器兼容性

注意: 不同浏览器之间显示有差异。Blink 内核浏览器(Chrome,Opera)会显示 HTML 资源的内容,但 Firefox 会显示一条通知消息,指出内容需要一个插件(见 bug 1237963)。建议使用 <object> 或 <iframe> 元素。

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic supportChrome Full support YesEdge Full support YesFirefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android ? Chrome Android ? Edge Mobile ? Firefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android ?
heightChrome Full support YesEdge Full support YesFirefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android ? Chrome Android ? Edge Mobile ? Firefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android ?
srcChrome Full support YesEdge Full support YesFirefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android ? Chrome Android ? Edge Mobile ? Firefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android ?
typeChrome Full support YesEdge Full support YesFirefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android ? Chrome Android ? Edge Mobile ? Firefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android ?
widthChrome Full support YesEdge Full support YesFirefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android ? Chrome Android ? Edge Mobile ? Firefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown

参阅

文档标签和贡献者

标签: 
此页面的贡献者: chenos, Martin.Chow, Startan
最后编辑者: chenos,