我在我的网站上使用SVG而不是实际的emoji,以确保它在所有设备上看起来都一样。但是,当我在iPhone上查看时,SVG的边缘看起来模糊不清。(在桌面上不会发生这种情况。)
第一节第一节第一节第一节第一次
As you can see from the first image (✌️emoji svg), some parts of the SVG are blurry while others are crisp. In the second svg, (💭emoji) the edges are completely blurry. It is not the svg that is causing the blurriness, it appears completely crisp on desktop. This is how I am inserting the svg:
.emoji {
background-position:center center;
background-repeat:no-repeat;
background-size:1em 1em;
display:inline-block;
height:1em;
margin:0 .05em 0 .1em;
vertical-align:-0.1em;
width:1em
}
.emoji.victory-hand {
background-image: url(../emojis/emoji/victory_hand_color_default.svg);
}
.emoji.thought-balloon {
background-image: url(../emojis/emoji/thought_balloon_color.svg);
}
<h2>hello<i class="emoji victory-hand"></i></h2>
<h2>projects <i class="emoji thought-balloon"></i></h2>
当我使用svg查看器查看或使用电脑时,svg很好,只有在手机上看起来模糊。有人知道为什么会发生这种情况吗?
2条答案
按热度按时间lymnna711#
正如评论所说,iOS safari显然以固定的分辨率渲染屏蔽的图像。
所以放大的时候图像会变模糊。
这可能就是为什么OP的表情符号中的一些轮廓是清晰的,而另一些是模糊的/像素化的原因。
左:遮罩形状;右:剪裁形状
变通方案:
<mask>
替换为<clipPath>
rjzwgtxy2#
safari有一个很大的问题,svg不能正确地呈现在设备的视网膜显示器上。
尝试添加:
到svg。
如果没有,它可能无法修复,因为Safari中的任何svg都不能很好地与大纲一起工作。
还可以尝试添加:
到svg。
如果不起作用,请尝试:
而不是geometricPrecision,它通过浏览器禁用图像的消除锯齿功能。