Why em instead of px?

后端 未结 15 1269
闹比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:38

    It's of use for everything that has to scale according to the font size.

    It's especially useful on browsers which implement zoom by scaling the font size. So if you size all your elements using em they scale accordingly.

提交回复
热议问题