Is it better to use ems/rems than px for font-size?

Avatar of Chris Coyier
Chris Coyier on

DigitalOcean provides cloud products for every stage of your journey. Get started with $200 in free credit!

The answer used to be absolutely yes because, if you used px units, you prevented the text from being resized by the user at all.

But browser zoom is the default method for making everything bigger (including text) these days and it works great even if you use px.

But… Kathleen McMahon really digs into this and finds that it’s still worth setting all your type (both font-size and line-height) in relative units because:

  1. setting type in px prevents browser settings from making font size adjustments (which some people definitely use) and
  2. setting type in relative units maintains greater design fidelity as users use browser zoom (which a lot of people definitely use).

Direct Link →