Why em instead of px?

后端 未结 15 1263
闹比i
闹比i 2020-11-22 06:38

I heard you should define sizes and distances in your stylesheet with em instead of in pixels. So the question is why should I use em instead of px when defining styles in c

15条回答
  •  迷失自我
    2020-11-22 07:24

    The general consensus is to use percentages for font sizing, because it's more consistent across browsers/platforms.

    It's funny though, I always used to use pt for font sizing and I assumed all sites used that. You don't normally use px sizes in other apps (eg Word). I guess it's because they're for printing - but the size is the same in a web browser as in Word...

提交回复
热议问题