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

后端 未结 2 1111
感动是毒
感动是毒 2020-12-31 08:05

If I use the following CSS:

p {
    font-size: 20.5px;
}

Will all browsers draw that as 20.5px, or will some round the value?<

2条回答
  •  生来不讨喜
    2020-12-31 08:21

    All latest versions of browsers allow for sub-pixel rendering*. See the research and the table of differences between browser versions.

    Older browsers mostly round the pixels down. Most notable exception is IE8 and IE9 which round to the nearest integer (IE7 does also round down, IE10 and up use sub-pixel rendering).

    * If you define the size in percentages, the value in pixels might be different as when you directly define it in pixels.

提交回复
热议问题