M
M
monochromer2015-11-23 13:17:16
css
monochromer, 2015-11-23 13:17:16

How to fix blurry svg icons in different browsers?

Hello!
There is an example of an svg icon.
It only displays properly in Chrome . In FF and IE it is blurred and clipped.
How to fix display? What can you suggest?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Lynn "Coffee Man", 2015-11-23
@monochromer

jsfiddle.net/qbshau80/4
Add transform: translateZ(0);to .link svg
Not tested in IE but helps in FF.
As far as I understand, in FF, when rendering SVG, all parent indents are taken into account, and if they do not exactly fall into pixels, then this is imperceptible in the blocks themselves, but the SVG anti-aliasing algorithm notices this. For example, if the parent's padding is not exactly 5px, but, let's say 4.95px, then you will never notice this, but the SVG will no longer hit the pixels clearly and will be “blurry”.
transformforces the rounding of the image border to pixels and everything falls into place.

A
Alexander Taratin, 2015-11-23
@Taraflex

https://jsfiddle.net/qbshau80/3/
https://developer.mozilla.org/ru/docs/Web/SVG/Attr...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question