Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

If browsers can zoom now, why should we use em instead of px?

Tags:

css

I've often seen people say that using 'em's is a better idea because it works better when people need to change their default font size.

But I've never heard of anyone changing their font size. However, I've heard of people (and done myself) zooming in and out. Zooming in and out works fine.

Are 'em's obsolete? Can I finally go back to pixels? Or do people still change the default font size? And if they do, do pixels still break when people change the font size?

like image 803
Verdagon Avatar asked Oct 21 '22 19:10

Verdagon


1 Answers

Well, em's are good in css when you want to create custom scalable buttons, you see. If you used pixels for the padding, then you'll be in for a heck of measurements, while if you used em's, the padding would dynamically scale in size according to the size of the font.

like image 124
Lucas Avatar answered Jan 02 '23 20:01

Lucas