aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/html/element/embed/index.html
blob: 611487ad6a0a6a025020eead02a0e7e761685362 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
---
title: <embed>:外部内容嵌入元素
slug: Web/HTML/Element/embed
tags:
  - HTML
  - HTML5
  - Web
  - 嵌入
translation_of: Web/HTML/Element/embed
---
<p><strong>HTML <code>&lt;embed&gt;</code> 元素</strong>将外部内容嵌入文档中的指定位置。此内容由外部应用程序或其他交互式内容源(如浏览器插件)提供。</p>

<p>{{Note("这篇文档仅定义该元素在 HTML5 中定义的部分,不包含该元素之前的声明内容和非标准的实现。")}}</p>

<p>请记住,大多数现代浏览器已经弃用并取消了对浏览器插件的支持,所以如果您希望您的网站可以在普通用户的浏览器上运行,那么依靠 <code>&lt;embed&gt;</code> 通常是不明智的。</p>

<table class="properties">
 <tbody>
  <tr>
   <th scope="row"><a href="/en-US/docs/HTML/Content_categories">Content categories</a></th>
   <td><a href="/en-US/docs/HTML/Content_categories#Flow_content">Flow content</a>, <a href="/en-US/docs/HTML/Content_categories#Phrasing_content">phrasing content</a>, embedded content, interactive content, palpable content.</td>
  </tr>
  <tr>
   <th scope="row">Permitted content</th>
   <td>None, it is an {{Glossary("empty element")}}.</td>
  </tr>
  <tr>
   <th scope="row">Tag omission</th>
   <td>Must have a start tag, and must not have an end tag.</td>
  </tr>
  <tr>
   <th scope="row">Permitted parents</th>
   <td>Any element that accepts embedded content.</td>
  </tr>
  <tr>
   <th scope="row">Permitted ARIA roles</th>
   <td>{{ARIARole("application")}}, {{ARIARole("document")}}, {{ARIARole("img")}}, {{ARIARole("presentation")}}</td>
  </tr>
  <tr>
   <th scope="row">DOM interface</th>
   <td>{{domxref("HTMLEmbedElement")}}</td>
  </tr>
 </tbody>
</table>

<h2 id="属性">属性</h2>

<p>这个元素的属性包括 <a href="/en-US/docs/HTML/Global_attributes">全局属性</a></p>

<dl>
 <dt>{{htmlattrdef("height")}}</dt>
 <dd>资源显示的高度,in <a href="https://drafts.csswg.org/css-values/#px">CSS pixels</a>.  -- (Absolute values only.  <a href="https://html.spec.whatwg.org/multipage/embedded-content.html#dimension-attributes">NO percentages</a>)</dd>
 <dt>{{htmlattrdef("src")}}</dt>
 <dd>被嵌套的资源的 URL。</dd>
 <dt>{{htmlattrdef("type")}}</dt>
 <dd>用于选择插件实例化的 MIME 类型。</dd>
 <dt>{{htmlattrdef("width")}}</dt>
 <dd>资源显示的宽度,in <a href="https://drafts.csswg.org/css-values/#px">CSS pixels</a>.  -- (Absolute values only.  <a href="https://html.spec.whatwg.org/multipage/embedded-content.html#dimension-attributes">NO percentages</a>)</dd>
</dl>

<h2 id="例子">例子</h2>

<pre class="brush: html">&lt;embed type="video/quicktime" src="movie.mov" width="640" height="480"&gt;
</pre>

<h2 id="规范">规范</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">规范</th>
   <th scope="col">状态</th>
   <th scope="col">备注</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('HTML WHATWG', 'embedded-content.html#the-embed-element', '&lt;embed&gt;')}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td> </td>
  </tr>
  <tr>
   <td>{{SpecName('HTML5 W3C', 'embedded-content-0.html#the-embed-element', '&lt;embed&gt;')}}</td>
   <td>{{Spec2('HTML5 W3C')}}</td>
   <td> </td>
  </tr>
 </tbody>
</table>

<h2 id="浏览器兼容性">浏览器兼容性</h2>

<div class="note">
<p><strong>注意</strong>: 不同浏览器之间显示有差异。Blink 内核浏览器(Chrome,Opera)会显示 HTML 资源的内容,但 Firefox 会显示一条通知消息,指出内容需要一个插件(见 {{Bug("730768")}})。建议使用 &lt;object&gt;&lt;iframe&gt; 元素。</p>
</div>



<p>{{Compat("html.elements.embed")}}</p>

<h2 id="参见">参见</h2>

<ul>
 <li>其他用于嵌入各种类型内容的元素还包括:{{HTMLElement("audio")}}, {{HTMLElement("canvas")}}, {{HTMLElement("iframe")}}, {{HTMLElement("img")}}, {{MathMLElement("math")}}, {{HTMLElement("object")}}, {{SVGElement("svg")}}{{HTMLElement("video")}}.</li>
</ul>

<p>{{ HTMLRef }}</p>