Results 1 to 5 of 5

Thread: Body font size of 1em; Browser Interpretation

  1. #1
    Join Date
    Jul 2006
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Body font size of 1em; Browser Interpretation

    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

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    If you mean a choice between:

    Code:
    body {
    font-size:1em;
    }
    and:

    Code:
    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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    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.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Jul 2006
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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.

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    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.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •