Anonymous 0

A question worth answering: does it really matter if I use .em units instead of pixels in CSS designs?

If so, for whom and in which context are these two units more appropriate? I'd appreciate sources that are up to date :) I made some research myself but most articles are like from 2007...

4 answers


Cameron Moll recently switched back to px after using em for a while. Try googling text scaling versus page zooming. His article is entitled "The debate over page zooming vs. text scaling" is dated 18 June 2009.

On a personal note, I build with px nowadays, since page zooming is the browser default and I don't read anything about it otherwise. I'll use ems for things that make sense based on the font of the section - I might want a margin-left of 1em as opposed to 5px, because if I change the font-size of that small section, it will look more to scale than just the literal pixel amount.

In Cameron's article, he references other sources old and new - even an A List Apart article as old as 2005. The principles aren't really changing, just analyze the needs that are best for your users.

Read the comments in that debate post - your layout may make text scaling annoying. It's really interesting what various users say.

Happy Cog, the co-founders of A List Apart (Zeldman), no longer use ems on their agency's web site - they use pixels. Ultimately, use your discretion, what do your users need, is it easy to use ems. If it's easy, why not just go ahead and do it?

One key comment in that post:

I doubt there is an absolute solution, especially since low vision encompasses a broad range of visual acuity.

So we return - do what is best for YOUR users, because your users are not necessarily my users, and what's best for me may not be best for you. Maybe I can leave IE6 behind, but maybe 50% of your readership uses IE6, so you must maintain its support. Everything is subjective.

Dan Cederholm just posted a 5 minute video on px vs. ems - - highly recommend you watching it.

Answered over 8 years ago by neatlysliced

I set my base font to 10px and after that I can use either as I need. 1 em = 10px. Therefore I mix and match % px and em at will. Life is easy these days..

Answered over 8 years ago by scott romack

Sizing text and line-height in ems, with a percentage specified on the body (and an optional caveat for Safari 2), was shown to provide accurate, resizable text across all browsers in common use today.

See this article on A List Apart for the detailed explanation:

Answered over 8 years ago by Gary Hepting

I'm revealing myself now. In my country the overall number of IE6 users are claimed to be only round 7% of web population, and it's declining. It's mainly public institutions where IE is simply not updated + some really ran down PCs. I can't imagine having an IE6 installation, it's just irresponsible.

Plus, I asked because I noticed how smoothly FF3 renders zooming, irrespective of whether it's em or px based. The same with Opera. Plus, I guess, neatlysliced said one thing that is crucial to me: what do users need?

This is difficult to establish. From my observation majority of people do not even know how to scale text in their browser. What is more, among the people I know, most of them (even middle- or old- aged) use FF3 where this issue is non-existent.

Besides Linux and MacOS users are less than 1% altogether. Now, should we rely on such statistics or make every effort to satisfy the needs of every group?

Is there a good discussion board to discuss such issues, something you'd recommend?

Answered over 8 years ago by cyrylski