What is the difference between px, em and ex?
- Pixels (
px
) are browser dependent. It is the absolute size that you would see on your screen. Em
are sort of like percentages.Em
s is referring to the base text size. The value of1 em
means the same thing as a value of100 percent
. But you can also say it in the opposite way: A percentage value is just anem
multiplied by 100.- Points(
pt
) are what you would want to use in print media.
em : the
font-size
of the relevant font
ex : thex-height
of the relevant font
px : pixels, relative to the viewing device