Is sizing fonts using “em” still relevant?

后端 未结 8 1791
-上瘾入骨i
-上瘾入骨i 2020-12-22 14:51

Those of you who use em when sizing fonts will know that they can be a headache when dealing with nested elements, and having to make the px -> em

8条回答
  •  误落风尘
    2020-12-22 15:50

    Although allowed, I've always felt it's a little nonsensical to size your fonts using em. When used for font sizing, it's a relative measure, and I think it just adds confusion to your CSS. If you really mean to give your font a size relative to it's parent font size, use percents. (font-size: 0.8em is equivalent to font-size: 80%, but the percent is more sensical.)

    Otherwise use one of the absolute units. Browsers handle and scale them fine now.

提交回复
热议问题