+ 2

Em or px for sizing in CSS.

Which should I choose? I have always used px and I am now learning Em is a thing. Is relative always better?

5th May 2018, 9:23 PM
Erik - avatar
3 Answers
+ 9
“Ems” (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. ... Pixels (px): Pixels are fixed-size units that are used in screen media (i.e. to be read on the computer screen). https://kyleschaeffer.com/development/css-font-size-em-vs-px-vs-pt-vs/ https://stackoverflow.com/questions/609517/why-em-instead-of-px
5th May 2018, 9:34 PM
Scooby - avatar
+ 3
thanks scooby
5th May 2018, 9:38 PM
Erik - avatar
I have always been told that ems were beter in general fue to their scalable nature which allowed your site to be displayed correctly on different size screens without breaking
19th Jun 2018, 11:20 AM
Haon1919 - avatar