Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Why do I need to use em? I thought browsers handled things like zooming on their own nowadays. What's wrong with px?


Ems are more versatile. When increasing the size of all fonts at a particular breakpoint for instance. Instead of having to adjust each font-size property individually you can simply change the font-size of the root element.


With em you define a base font-size in px. And then you express multiples of the base in em, instead of multiplying manually


How is it different, better/worse, than expressing font sizes as percentage?


Ems and percents behave differently when a user changes the browser's font size setting (which I think you only see in IE now), but are otherwise the same. Other than that the only advantage is in the fact that ems are a standard convention for designers and typographers, who are used to expressing measurements as a proportion of the text size, and "1 em" is just a more concise representation of that measurement than "100% of the point size of the font in use".




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: