让透明的 SVG 在 IE 和 Safari 中都能工作?
这对我来说似乎是一个非此即彼的问题。我可以让它们在其中之一中工作,但不能同时在两者中工作(无论我如何做,在 Firefox 中都可以正常工作)。
我已经阅读了很多关于这个主题的文章,除非 Safari 已经修复了这个问题,否则当 Safari 具有透明度并且您希望看到下面的其他元素时,纯外部 svg 似乎不受 Safari 支持并且无法正确渲染。 。唯一的解决方案是将 svg 内联放入 html 中,效果很好。当然,要做到这一点,它必须是 IE 9 以下不支持的 xhtml。
如果我在这些方面有误,请纠正我,但我非常喜欢使用 SVG 及其功能,但只是今天我用 IE 和 Safari 再次测试了这些问题,使用了单个 SVG 数据块,它在 Firefox 中内联和外部工作,并且在外部时在 Safari 中不起作用,当然也不能在 IE 的 xhtml 中内联工作<=8。
鉴于上述情况,我看不到一种简单的方法来破解解决方案,而无需以完全不同的方式制作两个单独的网站。显然,最好的机会似乎在于让外部 svg 文件与 Safari 一起使用,有人知道我没有读过的任何技巧吗?关于这个主题似乎没有太多内容。
干杯
This seems like an either or to me. I can get them to work in one or the other, but not both (while working fine in Firefox no matter how I do it).
I've been reading a lot on the subject, and unless it's already been fixed by Safari, it seems flat-out external svg is not supported by and does not render correctly in Safari when they have transparency and you want to see other elements underneath. The only solution for that is to put the svg inline in your html and it works fine. Of course to do that it has to be xhtml which isn't supported by less than IE 9.
Please correct me if I'm wrong on either of these counts, but I very much like using SVG and the power it has, yet just today I tested these problems again with IE and Safari, using a single chunk of SVG data, that works inline and externally in firefox, and will not work in Safari when external, and of course does not work inline in xhtml with IE <=8.
I can't see an easy way to hack a solution given the above without making two separate sites made in completely different ways. Obviously the best chance seems to lie with getting external svg files to work with Safari, does anyone know any tricks that I haven't read about? There doesn't seem to be much out there on the subject.
Cheers
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此演示适用于 Safari/Chrome/FF/IE9。 SVG 在 早期版本的 IE 中不起作用(嵌入或引用),因此它不会不在那里工作。
简而言之:
This demo works on Safari/Chrome/FF/IE9. SVG does not work (embedded or referenced) in earlier versions of IE, so it won't work there.
In short: