I use svg icons that look fine on different browsers, but on IE11 some of the borders of the svg elements, like rect or line, are not visible on certain zoom levels. For example, at 23px width, everything is visible, but on 24px some borders disappear.
This is a normal image:
This is zoomed in a bit:
Another zoom level:
To get more consistent scaling across browsers always ensure you specify a viewBox
but leave off the width
and height
attributes on your svg
element.
source: SVG in img element proportions not respected in ie9
A shell command that will remove width
& height
attributes from all SVG files in the current directory:
find ./ -name '*.svg' -print0 | xargs -0 sed -i "" -e 's/width="[0-9]*\\.*\\[0-9]*" //' -e 's/height="[0-9]*\\.*\\[0-9]*" //'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.