Hip
Hip

Reputation: 87

How does a user benefit from "em" measurements instead of "px"?

I've read quite a bit about the "em" measurement for "font-size" and I've noticed that some say that especially disabled users benefit from "em" because they can adjust the size of font.

I'm new to CSS & HTML and I do not understand how this really works. As I understand I can always - as a user - enlarge the viewing size in my browser. Doesn't this also work when I use "px" all the time?

Upvotes: 0

Views: 98

Answers (1)

Curtis White
Curtis White

Reputation: 250

Em represents a page's default size, so for example, 1em might be 12px, but for larger screens may be something else, perhaps 16px. 2em would be twice that size of 1em.

The takeaway is em scales with the screen resolution and is a good choice for responsive design.

Px on the other hand is a specific, fixed sizing guide, where a pixel is one square on a screen. So 12px on one screen may look small on a larger screen.

I recommend using em for most purposes unless there's a good reason you need a specific pixel size.

Upvotes: 1

Related Questions