CSS: em or px
- Started
- Last post
- 24 Responses
- Dancer
All the info I find on the web uses ems but I tend to use pixels. What to you use for measurement whne building and why?
- determinedmoth0
i just started using ems for type.
it's a pain in the butt. I still use px for everything else though.
- grafholic0
use px because:
* em: the 'font-size' of the relevant font
* ex: the 'x-height' of the relevant font
* px: pixels, relative to the viewing device
- Dancer0
Hey Moth didn't know you would be about.
I use px because I know that if I design a site in PS I know exactly where to put my DIVs.
Exactly how many pixels are there to an em?
- Dancer0
"* ex: the 'x-height' of the relevant font"
Surely this does not relate to CSS?
- IRNlun60
ex: one ex is the x-height of a font, the x-height is usually about half the font-size...
http://www.w3schools.com/css/css…
don't think this helps you much though. has to be a conversion chart somewhere...
- heavyt0
well, ems are flexible for IE, so they can use there browser prefs for adjusting size.
Having said that, i use px. Because i can control the layout, as opposed to basing everything relative to the user's base font size (which is not predictible).
TR1
- serif0
em's are a relative measurement that can be scaled by the user even when you specify an exact size in css.
px's on the otherhand are absolute or fixed and pretty much set in stone. the user cannot affect the size by trying to increase font size on their browser, whereas with em's they can.
- welded0
You can adjust px in most browsers with ol' cmd+ and cmd-. That is, not IE.
- serif0
welded's right...i stand corrected.
was developing for PC's or I.E. so long (and so long ago), i came to think of it as a unit that was stone for some reason across the board.
apropos that, is there a unit that is FIXED across browsers and platforms? i am curious now...
- welded0
I don't think it's possible (IE aside) to fix a type size short of using Flash or a bitmap. It's an accessibility thing. Jakob Nielson would wake up in a cold sweat every night otherwise.
- serif0
tru dat, welded. ha-ha j nielsen, good call.
- SF20
This could be useful to you all
- welded0
Neato.
- jevad0
THATS FUCKINH AWESOME
- Beech0
sweet ass link :)
- SF20
Cheers, though credit where credit is due.
Worthy blog/rss feed - http://css.weblogsinc.com/
Not updated heaps, but usually has quality links.
- craic_whore0
try this
body{font-size: 62.5%;}
p{font-size: 1.3em;}
the 1.3 is equal to13px but scalable in ie. 2.6 is 26px etc.
- craic_whore0
Reason is that the default size for all browsers is 16px (1em = 16px). Making the body equal 62.5 knocks the default back to 10px (1em = 10px) that makes 1.5em equal 15px etc. etc.
- paraselene0
thanks craic, that looks helpful. i'll give it a go.
- craic_whore0
no probs