我有一个不透明的背景图像。它在 Firefox 和 Chrome 中工作正常,但它的不透明度在 Safari 中不起作用。有没有办法解决这个问题,或者 Safari 不支持它?
这是我的 SVG
<svg version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
x="0px" y="0px" width="640.2px" height="1136px" viewBox="0 0 640.2 1136" style="enable-background:new 0 0 640.2 1136;"
xml:space="preserve">
<style type="text/css">
.st0{fill:#5AAAFA;}
.st1{opacity:4.000000e-02;}
</style>
<defs>
</defs>
<polygon id="XMLID_18_" class="st0" points="640.2,1136 0.2,1136 0.2,0 640.2,0 640.2,367.1 "/>
<path id="XMLID_17_" class="st1" d="M0,810.6c0.1,108.5,0.2,216.9,0.2,325.4h640c- 0.4-320.4-0.7-640.8-1.1-961.2
C426.1,386.7,213.1,598.7,0,810.6z"/>
</svg>
谢谢!
最佳答案
显然,某些浏览器在处理使用科学计数法编写的数字时遇到问题(例如 4.000000e-02
而不是 0.04
)。这是一个错误,因为 scientific number representations are permitted by the CSS standard .
但是有一个简单的解决方法;只需更改此:
opacity:4.000000e-02;
对此:
opacity:0.04;
它应该可以工作。
关于SVG 不透明度在 Safari 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35886513/