DEV Community

Maciej Manista
Maciej Manista

Posted on

Avoid using float values for font-size property

Let's say that the designs you received include using float values as font-size (e.g. 14.5px). What do you do?

Don't use it.

Don't get fooled by the fact that it works for Chrome and Firefox.
Safari (with the default zoom) is not handling these accurately. It's rounding the value up or down.

>= .5 - rounded up: 10.5px => 11px
< .5 - rounded down: 10.4px => 10px

That basically means that on Safari font-size: 10.5px will render just the same as you would use font-size: 11px.

Top comments (0)