tags:

views:

218

answers:

3

Hello, I am trying to debug why having font-size: 1.0em in jquery-ui is causing my font sizes for my page to go huge(over 16px) without me doing any actual resizing of the fonts. Well, in Firebug I saw a weird thing for an accordion.

At the base, it had font-size: 1.0em but later that was overriden by font-size: 100%. Could that cause some sort of problem with font sizing? I was always under the impression that 100% was the same as 1.0em

A: 

em is defined in a per user per browser basis. So em is defined for accesability in the different settings of a browser or a user preference.

It means that 1em could be 16px or 10px according to the user preference setting in the browser.

If you want to have more control over your font-sizes, use px instead of em.

jpabluz
Yea, but I mean it's like at the body level the font is 12px naturally(the way I have my browser setup), but then inside of a lot of nested elements the font somehow goes to 16px, when the only font-size changes I have is `1.0em` and `100%`
Earlz
+6  A: 

Yes.

1em and 100% mean the same thing (for font-size) — "The same font-size as the parent element" (which is not the same thing as the font size the user has selected unless you are talking about the HTML element).

There are bugs in Internet Explorer when em is used and the font size picked from the view menu is not medium.

David Dorward
+3  A: 

Yes, em and percentage are interchangeable in terms of font size.

I can't really tell what's going wrong in your case without code, but it may have something to do with nested font sizes:

<div style="font-size: 150%;">
    This text is at 150% of the base.

    <div style="font-size: 100%">
        This text is the same size as the text above.
    </div>
</div>
AaronSieb
The font is never changed unless it's to `1.0em` or `100%` though.. so those two values are the same then right?
Earlz
Yes, they are the same.
AaronSieb