css – 指定所有浏览器都遵守的字体大小时是否为十进制精度?

前端之家收集整理的这篇文章主要介绍了css – 指定所有浏览器都遵守的字体大小时是否为十进制精度?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
如果我使用以下CSS:
p {
    font-size: 20.5px;
}

是否所有浏览器都将其绘制为20.5px,或者某些值是否为圆形?

解决方法

在所有浏览器中,小数都不是一致的.我能找到的最好的帖子是: Browser Rounding

这包含一个显示以下内容的表:

Internet Explorer 7 truncate to 2 decimal places
Internet Explorer 8 truncate to 2 decimal places
Internet Explorer 9 truncate to 2 decimal places
Internet Explorer 10    truncate to 2 decimal places
Internet Explorer 11    truncate to 2 decimal places
Firefox 3.0 truncate to 3 decimal places
Firefox 3.5 truncate to 3 decimal places
Firefox 31  truncate to 3 decimal places
Chrome 20   round to 15 decimal places
Chrome 21   round to 15 decimal places
Chrome 37   round to 13 decimal places
Safari 6 (OSX Lion) round to 15 decimal places
Safari 6.1 (OSX Mountain Lion)  round to 15 decimal places
Safari 7 (OSX Mavericks)    round to 15 decimal places
Mobile Safari 7 (iOS7)  round to 15 decimal places
Mobile Safari 8 (iOS8)  round to 15 decimal places
Chrome 36(Jelly Bean) [Nexus5] round to 15 decimal places
Chrome 30(KitKat) [S5] round to 15 decimal places
Android Browser 4(Jelly Bean) [Nexus7,Nexus4,S4,S3]    round to 15 decimal places
Android Browser 4(Ice Cream Sandwich) [Nexus,KindleFire2]  round to 15 decimal places
Android Browser 4(Gingerbread) [S2]    truncate to 3 decimal places
Opera 12    truncate to 2 decimal places
Opera Next 24   round to 13 decimal places
原文链接:https://www.f2er.com/css/217854.html

猜你在找的CSS相关文章