What is the difference between px, em and ex?

后端 未结 5 570
我在风中等你
我在风中等你 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:27

    1. Pixels (px) are browser dependent. It is the absolute size that you would see on your screen.
    2. Em are sort of like percentages. Ems is referring to the base text size. The value of 1 em means the same thing as a value of 100 percent. But you can also say it in the opposite way: A percentage value is just an em multiplied by 100.
    3. Points(pt) are what you would want to use in print media.

提交回复
热议问题