且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

旋转嵌套 SVG

更新时间:2023-11-19 12:55:52

您的问题是由于在 SVG 1.1 中, 元素不允许 转换 属性.它现在在 SVG 2 中是允许的,但到目前为止只有 Firefox 已经实现了.Chrome 还没有.

Your problem is due to the fact that, in SVG 1.1, the <svg> element did not allow the transform attribute. It is now allowed in SVG 2, but only Firefox has implemented that so far. Chrome has not yet.

解决方案是先追加一个组,然后将SVG放入该组中.然后,您可以改为转换该组,它可以在两种浏览器中使用.

The solution is to append a group first, then put the SVG in that group. You can then transform that group instead, and it will work in both browsers.

正如@noob 在他们的回答中所建议的那样.如果您愿意,请随时接受他们的回答.

Just as @noob has suggested in their answer. Feel free to accept their answer if you like.