Google Font size 10.5 px (.5) the correct way and multibrowser support

后端 未结 3 940
不思量自难忘°
不思量自难忘° 2021-01-16 19:52

I am using Google font Open Sans and if I set the font to font-size 11px it looks big for the text I need and if I set it to 10px it looks small so I tested just for fun and

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-16 20:12

    Convert your font size to a scalable unit like em or rem, and you can get what you are looking for.

    By default, 1rem = 16px. so 10.5px = 0.65625rem.

    The added benefit is accessibility. Some users may increase their default font size. Your text will scale accordingly if you use em or rem units. Pixel sizes won't.

提交回复
热议问题