【发布时间】:2017-06-17 04:47:57
【问题描述】:
根据 MDN (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio),音频标签的“允许的父级”是“任何接受嵌入内容的元素”,即:audio、canvas、[@987654326 @]、iframe、img、math、object、picture、svg、video (https://www.w3.org/TR/html51/dom.html#embedded-content)。
所以,我不明白audio 标签或canvas|iframe|img 等标签如何成为audio 标签的“准许父母”,但我' d 理解它们可以是body 标签和一些(不是全部)元素“归类为流内容”,例如div、article 等标签。
MDN 页面是否有错误,或者(更有可能)我只是不明白?
<audio src="http://soundbible.com/grab.php?id=2083&type=mp3" controls>
<audio src="http://soundbible.com/grab.php?id=2083&type=mp3" controls>
Your browser does not support the audio tag.
</audio>
Your browser does not support the audio tag.
</audio>
<canvas width="200" height="100" style="border:1px solid black;">
<audio src="http://soundbible.com/grab.php?id=2083&type=mp3" controls>
Your browser does not support the audio tag.
</audio>
Your browser does not support the canvas tag.
</canvas>
【问题讨论】:
-
我认为您将“嵌入内容”与“接受嵌入内容”混淆了。
<audio>是嵌入内容元素,其父元素是接受嵌入内容的任何元素。 -
@J08691,谢谢。我知道了。因此,除了列出“内容种类”(w3.org/TR/html51/dom.html#kinds-of-content)之外,它还将有助于接受各种类型的内容(嵌入、流和 c)的元素列表(该列表的)。这个进一步的列表存在,或者每当您需要检查某个标签是否接受某种类型的内容时?
标签: html