简体   繁体   English

使用带参考PNG的SVG作为背景图像

[英]Using SVG with referenced PNG as background image

鉴于SVG使用<image xlink:href="http://...来引用PNG图像<image xlink:href="http://...为什么我不能将SVG用作CSS的背景图像?如果我直接在浏览器中调用SVG(使用Chrome测试)和Firefox),它向我展示了带有PNG的SVG和调试工具(网络选项卡)也显示外部图形被调用。在HTML中使用指向SVG的<object>标签也可以工作。还可以使用嵌入使用base64将PNG导入SVN,这允许我使用SVG作为背景图像,但是如果图像是路径则不行。测试页面,CSS,SVG和我在SVG中链接的图像都在同一台服务器上。

The functionality is documented in the SVG Integration specification SVG集成规范中记录了该功能

When you use SVG as a background image its functionality is that of an 当您使用SVG作为背景图像时,其功能是

animated image document 动画图像文件

It therefore runs in secure animated mode . 因此它以安全的动画模式运行

And one of secure animated mode's restrictions is that external references are not allowed. 安全动画模式的限制之一是不允许外部引用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM