<embed>:嵌入外部内容元素
<embed>
HTML 元素在文档中的指定点嵌入外部内容。该内容由外部应用或其他交互式内容源(例如浏览器插件)提供。
¥The <embed>
HTML element embeds external content at the specified point in the document. This content is provided by an external application or other source of interactive content such as a browser plug-in.
Try it
注意:本主题仅记录定义为 HTML 生活标准 一部分的元素。它不涉及该元素的早期非标准化实现。
¥Note: This topic documents only the element that is defined as part of the HTML Living Standard. It does not address earlier, non-standardized implementation of the element.
请记住,大多数现代浏览器已经弃用并删除了对浏览器插件的支持,因此如果你希望你的网站可以在普通用户的浏览器上运行,那么依赖 <embed>
通常并不明智。
¥Keep in mind that most modern browsers have deprecated and removed support for browser plug-ins, so relying upon <embed>
is generally not wise if you want your site to be operable on the average user's browser.
属性
使用说明
¥Usage notes
你可以使用 object-position
属性来调整嵌入对象在元素框架内的位置,并使用 object-fit
属性来控制如何调整对象的大小以适合框架。
¥You can use the object-position
property to adjust the positioning of the embedded object within the element's frame, and the object-fit
property to control how the object's size is adjusted to fit within the frame.
无障碍
¥Accessibility
在 embed
元素上使用 title
属性 来标记其内容,以便使用屏幕阅读器等辅助技术进行导航的人员可以理解其包含的内容。标题的值应该简洁地描述嵌入的内容。如果没有标题,他们可能无法确定其嵌入的内容是什么。这种上下文转换可能会令人困惑且耗时,尤其是当 embed
元素包含视频或音频等交互式内容时。
¥Use the title
attribute on an embed
element to label its content so that people navigating with assistive technology such as a screen reader can understand what it contains. The title's value should concisely describe the embedded content. Without a title, they may not be able to determine what its embedded content is. This context shift can be confusing and time-consuming, especially if the embed
element contains interactive content like video or audio.
示例
技术总结
¥Technical summary
内容类别 | 流量内容, 措辞内容,嵌入内容,交互内容, 可触知的内容。 |
---|---|
允许的内容 | 没有任何;这是 void element。 |
标签遗漏 | 必须有开始标记,并且不能有结束标记。 |
允许的父级 | 任何接受嵌入内容的元素。 |
隐式 ARIA 角色 | 没有对应的角色 |
允许的 ARIA 角色 |
application , document ,
img , none ,
presentation
|
DOM 接口 | HTMLEmbedElement |
规范
Specification |
---|
HTML Standard # the-embed-element |
浏览器兼容性
BCD tables only load in the browser
也可以看看
¥See also
- 用于嵌入各种类型内容的其他元素包括
<audio>
、<canvas>
、<iframe>
、<img>
、<math>
、<object>
、<svg>
和<video>
。 - 在框架内定位嵌入内容并调整其大小:
object-position
和object-fit