SVG在Chrome和Firefox上的显示方式不同 [英] SVG being displayed differently on Chrome and Firefox

查看:563
本文介绍了SVG在Chrome和Firefox上的显示方式不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个svg,但在Chrome和Firefox上的显示方式不同:这是一个只有Windows的错误,将在Firefox 37中修复,所以现在不要走了。


I have one svg but it looks differently on Chrome and Firefox: http://codepen.io/anon/pen/OParwx.

svg {
  fill: black;
  stroke: black;
  width: 40px;
  height: 40px;
}

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0,0,48.266,51.827">
  <g>
    <path d="M16.69 41.827c-2.763 0-4.975 2.237-4.975 5s2.212 5 4.975 5c2.763 0 5-2.237 5-5s-2.237-5-5-5"/>
    <path d="M40.19 41.827c-2.763 0-4.975 2.237-4.975 5s2.212 5 4.975 5c2.763 0 5-2.237 5-5s-2.237-5-5-5"/>
    <path d="M26.768 20v-20 20z" stroke-width="5" stroke-miterlimit="10" fill="none"/>
    <path d="M36.768 10h-20 20z" stroke-width="5" stroke-miterlimit="10" fill="none"/>
  </g>
  <g>
    <path d="M0 5.059h6.406l10.99 22.455h20.469l10.401-18.777" stroke-width="5" stroke-miterlimit="10" fill="none"/>
    <path d="M45 37.689h-29.947s-3.594.077-2.579-4.036l4.923-6.139" stroke-width="5" stroke-miterlimit="10" fill="none"/>
  </g>
</svg>

Here's how they look like

Chrome

Firefox

What makes them different and how to fix it?

Edit: a temporary solution (besides waiting for the bug is fixed on Firefox 37) is to remove stroke-miterlimit and add stroke-linejoin="bevel"

解决方案

You're suffering from bug 854296 It's a Windows only bug that will be fixed in Firefox 37 so not long to go now.

这篇关于SVG在Chrome和Firefox上的显示方式不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆