指定所有浏览器都尊重的字体大小时小数精度是否?

Is decimal precision when specifying a font-size respected by all browsers?

如果我使用以下 CSS:

p {
    font-size: 20.5px;
}

所有浏览器都会将其绘制为 20.5px,还是某些浏览器会将值四舍五入?

并非所有浏览器都对小数进行四舍五入。我能找到的最好的 post 在这里:Browser Rounding

这包含一个 table,显示以下内容:

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

所有最新版本的浏览器允许亚像素渲染*。见 research and the table of differences between browser versions.

旧版浏览器大多将像素四舍五入。最值得注意的例外是 IE8 和 IE9,它们四舍五入到最接近的整数(IE7 也向下舍入,IE10 及更高版本使用子像素渲染)。

* 如果您以百分比定义大小,则以像素为单位的值可能与您直接以像素为单位定义的值不同。