Google Chrome (Version 89.0.4389.114, 64-bit) has some strange behaviour when using a %
value for the font-size
property.
In stead of the expected behaviour, reducing the font size to a given percentage, it will stop doing so if the calculated font size would be smaller than 6px
, and it will not go below that magic 6px
. FireFox does scale down the font as expected.
Example:
I created this fiddle in which I scale down the font at the :root
to 1%
. In both browsers, the default font size is 16px
, so the expected font size is 0.16px
. FireFox does indeed render it as such, Chrome however does not, as the rendered font size is 6px
. An image with FireFox on the left and Chrome on the right to illustrate the issue without you having to fiddle around https://pbs.twimg.com/media/EyTFQ3WWgAA_fL6?format=png&name=large.
So I am wondering, does anyone know how to bypass this?
I need it to work for the %
unit, as I use it to enable this "rem to px" conversion. By setting :root
's font-size
to 6.25%
, 1rem
will equal 1px
(if the browser's default font size is set to 16px
). This allows me to develop the site in rem
units without having to deal with conversions all the time. The benefit? The site will now scale perfectly when the user decides to change their default font size to, f.e., 20px
.
I haven't found a workaround yet, so any ideas are much appreciated!
Cheers