Jump to content

difference between pixal and .em


newceylon

Recommended Posts

There is no relation between pixels and ems, ems are based on the browser's settings.As far as I know, 1em is equal to the width of the letter m in the browser's default font size. Each browser has their own default font and size.

Link to comment
Share on other sites

I found this definition which is pretty clear:

An em-unit, if you read the specification[1] is described as being equal to the font size of the element. So, if the font size is set to 22px, an em will be equal to exactly 22px. The main advantage to using em-values is that any lengths specified as "X" em will be scaled with the text using common user-agent text resize features...Source:

Here's a link to the W3C site explaining (I honestly think that the way things are explained in W3C is sometimes SO hard to understand, I hate their explanations :) ): http://www.w3.org/TR/CSS21/syndata.html#length-unitsCalculator:Here's an Em calculator, kind of cool. According to this calculator 1px = 0.06em: http://riddle.pl/emcalc/--Now, to design websites I learned that the proper way to handle font sizes is by using em instead of px, because with ems the website's font displays proportionate to the browser's default settings, and it also complies with Accessibility in the case the user needs to enlarge the font to read, with pixels the font would stay the same size (although several browser override this too now).Bytes.

Link to comment
Share on other sites

Technically, one "em" is actually the width of the letter "m" at the current font size.I think you can guess how much one "en" is now :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...