PDA

View Full Version : Body font size of 1em; Browser Interpretation



Girard Ibanez
03-04-2007, 05:21 AM
Declaring a font-size of 1em in the css body conflict with any browser's interpretation?

Or should I use a value of 100%.


Thanks

jscheuer1
03-04-2007, 06:28 AM
If you mean a choice between:


body {
font-size:1em;
}

and:


body {
font-size:100%;
}

Both are meaningless but, 100% is a safer 'meaningless'.

Think about it though. 1em means 1 of the size of the font size in effect. 100% means all of the size of the font size in effect. They both are like telling the browser:

"As far as font size goes, what you are doing already is fine, make no change."

100% is safer only because IE sometimes gets confused with em's and font size. Therefore, em's should only be used for dimensions due this shortcoming.

If you want 100% or 1em as a font size, don't declare it, it is the default.

Twey
03-04-2007, 01:15 PM
Think about it though. 1em means 1 of the size of the font size in effect. 100% means all of the size of the font size in effect. They both are like telling the browser:

"As far as font size goes, what you are doing already is fine, make no change."Not quite. An em is literally the height or width of the lowercase character "m" in the current font. Some letters are taller than "m," so the actual font size is usually about 1.2em.

Girard Ibanez
03-04-2007, 04:04 PM
Thanks,

I now that makes alot more sense.

On another note, does IE 7 suffer the same problem with the fault box width/height issue. Or is IE 7 compliant in the box model.

Twey
03-04-2007, 04:10 PM
Yes, it still suffers from it.

Microsoft haven't really made an effort with IE7's compliance, just patched over a few of the most annoying minor problems.