[OT?] CSS length units and font-size (was Re: [plug] Joining PLUG)

Ben New ben at leftclick.com.au
Mon Nov 24 10:43:33 WST 2003


James Devenish wrote:

>In message <3FC167E1.7070702 at leftclick.com.au>
>on Mon, Nov 24, 2003 at 10:07:29AM +0800, Ben New wrote:
>  
>
>>Maybe I'm a bit late but the W3C recommends using "em" units for the 
>>font-size. The normal text should be 1em. That way the letters are 
>>supposed to be the same size on everyone's monitor
>>    
>>
>
>Not really, 1em will be default size for each person's font
>configuration, but that default size may differ from person to
>person. 100%, in function, should be equivalent to 1em.
>  
>

OK now I'm actually awake I just re-read my original post and realise 
how much crap it was full of! I would like to formally retract my whole 
post and hopefully get it right here:

For the 'font-size' property, 'em' is equivalent to %. I only just 
learned that much today. I always thought 'em' was taken as a base 
measurement of the OS's default font size, and every time you used 'em' 
it related to that. (That's not what I said in my original post I know, 
like I said it was full of crap).

Actually 'em' is relative to the parent element (for the 'font-size' 
property only) which is the same as how % works for font-size. For other 
properties, 'em' is relative to "the 'font-size' of the relevant font":
http://www.w3.org/TR/REC-CSS2/syndata.html#value-def-length

I've always just used 'em' because it's recommended in the sample 
stylesheet:
http://www.w3.org/TR/REC-CSS2/sample.html

Just to re-iterate: 'em' is a relative unit (relative to the parent 
element's font-size), *not* like 'cm' or 'in', which are absolute units, 
i.e. are supposed to be the same size on everyone's monitor. Pixels 
('px') is also a relative unit, but in that case relative to the viewing 
device (resolution), so is not really very good for the font-size property.

I don't know what I was going on about before, all I can say is "Monday 
morning"...

Right, I'm going to shut up now!

Ben

-- 
Ben New
ben at leftclick.com.au

Leftclick Software Development
http://www.leftclick.com.au/



_______________________________________________
plug mailing list
plug at plug.linux.org.au
http://mail.plug.linux.org.au/cgi-bin/mailman/listinfo/plug


More information about the plug mailing list