Em vs Px and cross browser compatibility

后端 未结 4 1004
逝去的感伤
逝去的感伤 2021-02-07 19:07

I\'m a CSS newbie and was wondering if there is a benefit using em instead of px when it comes the cross browser compatibility of my CSS.

4条回答
  •  孤城傲影
    2021-02-07 20:06

    Yes. Some browsers (-cough IE8 -cough)still do not scale text properly when it's in pixels. They zoom fine, but changing the text size gives no results.

    Ems is more or less guaranteed to scale when the user requests it to. Also, ems can be used for navigation buttons or boxes that accommodate text that must scale well with the text- it's not just a font size. Try different variants in a bunch of browsers zooming in an out and enlarging text and see what results you get.

提交回复
热议问题