What is the difference between px, em and ex?

后端 未结 5 515
我在风中等你
我在风中等你 2020-11-29 03:45

What is the difference between px, em and ex? And when you define font-size in CSS, do you use px, pt or

5条回答
  •  自闭症患者
    2020-11-29 04:21

    em : The em is a scalable unit that is used in web document media. An em is equal to the current font-size, for instance, if the font-size of the document is 12pt, 1em is equal to 12pt.

    px : Pixels are fixed-size units that are used in screen media (i.e. to be read on the computer screen). One pixel is equal to one dot on the computer screen (the smallest division of your screen’s resolution).

    pt : Points are traditionally used in print media (anything that is to be printed on paper, etc.). One point is equal to 1/72 of an inch. Points are much like pixels, in that they are fixed-size units and cannot scale in size.

提交回复
热议问题