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

后端 未结 3 941
不思量自难忘°
不思量自难忘° 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.

    0 讨论(0)
  • 2021-01-16 20:21

    Basically, the answer is that no, it is not a good approach if you want to make sure that your font renders precisely in a cross-browser fashion. There is no such thing as a half-pixel when it comes to rendering the font, so you leave yourself open to different browser-applied rounding effects which could differ from browser to browser and between client devices, which have different resolutions and pixel densities.

    0 讨论(0)
  • 2021-01-16 20:21

    Use percentage instead, you won't get the same size on different displays/browsers, but you should get more control over the size of your text.

    e.g: font-size: 98%;

    This article may help.

    0 讨论(0)
提交回复
热议问题