homepage Welcome to WebmasterWorld Guest from 54.204.141.129
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderator: open

CSS Forum

    
Difference Between %'s an EM's as Font Units
What are the REAL differences?
Nick_W




msg:1183118
 11:34 am on Jan 8, 2003 (gmt 0)

Hi all,

As far as I can make out the real diffence is only browser support. %'s have a slightly better acceptance in older browsers than the EM.

Personally I prefer EM's though as they're a dedicated font unit. Your thoughts?

Nick

 

topr8




msg:1183119
 11:49 am on Jan 8, 2003 (gmt 0)

i've always used % as i figured it works on a percentage scale of the default size font, so that if someone has set it bigger then it comes up relative to their preference rather than forcing a size (which has advantages for layout)

WibbleWobble




msg:1183120
 12:57 pm on Jan 8, 2003 (gmt 0)

Doesn't having 0.9em resize it relative to their font, too? Thats the impression I have.
I've always been a tad baffled by ems, they're just weird. I use them, but still. Weird.

chameleon




msg:1183121
 1:22 pm on Jan 8, 2003 (gmt 0)

Doesn't having 0.9em resize it relative to their font, too?

Yes, it does.

In my experience with IE, however, 0.9EM does not equal 90%.

I'm not sure how they're calculating the EMs or the percentages, but somehow the calculations are different.

Netscape and IE also calculate EMs differently. If I'm not mistaken, RichInStyle.com has more info on this topic.

Nick_W




msg:1183122
 2:19 pm on Jan 8, 2003 (gmt 0)

Well, the model for font units says that 0.9em should equal 90% - I always use em's. 1em = the container default which means that not setting a font size leaves it at the uesrs preferred size.

Of course that's all so much crap when you think about how many people have no idea of how to change their font size! but, it beats absolute units hands down ;)

Nick

WibbleWobble




msg:1183123
 2:44 pm on Jan 8, 2003 (gmt 0)

I always have real trouble forcing myself to let people decide on the font size themselves, partly because anything over 14px/12pt looks really, really terrible, in my opinion.
Don't get me wrong, I know there are people out there who need to have bigger text, but I don't like them ruining what is essentially a lovely design and layout by being poor-sighted. I'm fickle.

marek




msg:1183124
 6:13 pm on Jan 8, 2003 (gmt 0)

0.9em should equal 90%, but in IE/Win this is true only if medium font size is set in the browser, or basic font size in CSS is set by percents. Try to view the following two simple exmaples in IE6/Win and change your font size to smallest.

Example #1

h1 {font-size: 3em}
p {font-size: 0.8em}

Example #2

body {font-size: 100%}
h1 {font-size: 3em}
p {font-size: 0.8em}

HTML for the both samples above:

<body>
<h1>Test</h1>
<p>test test test test test test</p>
</body>

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved