Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在SVG中拥有背景视频?_Svg_Html5 Video - Fatal编程技术网

如何在SVG中拥有背景视频?

如何在SVG中拥有背景视频?,svg,html5-video,Svg,Html5 Video,使用foreignObject可以在SVG中使用标记,如下所示: <foreignObject width="100" height="100" x="10" y="250"> <video xmlns="http://www.w3.org/1999/xhtml" style="background: #ffffff; width: 150px; height: 50px;"> <source src="https://www.quirksmode.or

使用
foreignObject
可以在SVG中使用
标记,如下所示:

<foreignObject width="100" height="100" x="10" y="250">
  <video xmlns="http://www.w3.org/1999/xhtml" style="background: #ffffff; width: 150px; height: 50px;">
    <source src="https://www.quirksmode.org/html5/videos/big_buck_bunny.mp4"/>
  </video>
</foreignObject>
…但一旦你把
粘在里面,它就不起作用了

这只是chrome中的一个bug吗

我查看了bug跟踪器,虽然有大量与SVG相关的bug,但大多数相关bug都标记为已解决

我做错什么了吗?据我所知,SVG中
项的顺序应该决定z索引

下面是一个最小的可复制测试用例

(我还登录了firefox,但它在那里也不工作…)


你好,世界

根据我的说法,这是一个Chrome bug,它仍然是Chrome版本72.0.3626.119(官方版本)(64位);Firefox 65.0.1(64位)正确渲染。我用了下面的测试页面


知识是一种美德,是一种美德,是一种美德,是一种美德。但是,在最低限度上,我们需要一个实验室来进行日常工作。两人或两人在一个无教区的房间里互相指责。除偶尔因疏忽而死亡外,不得因疏忽而导致动物死亡

<rect x="10" y="10" width="200" height="200" fill="red"/>
<foreignObject width="100" height="100" x="10" y="50">
  <div xmlns="http://www.w3.org/1999/xhtml" style="background: #ffffff; width: 150px; height: 50px;">
    Hello World
  </div>
</foreignObject>
<rect x="100" y="60" width="200" height="200" fill="blue"/>