SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 34 of 34
  1. #26
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    As a base font size for a document, 1em (or 100%) is equivalent to setting the font size to the user's preference.

    Typically in most browsers they assume default of around 16px usually most Windows people are at a font of 96 dpi. Using the reference pixel for reading at arm's length, 1px thus corresponds to about 0.26 mm (1/96 inch).

  2. #27
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,347
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by xhtmlcoder View Post
    As a base font size for a document, 1em (or 100%) is equivalent to setting the font size to the user's preference.
    thanks

    which is why i don't bother setting it at all

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #28
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    No problems (and even if you did set it the user(agent) is still boss.)

  4. #29
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,875
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by xhtmlcoder View Post
    As a base font size for a document, 1em (or 100&#37 is equivalent to setting the font size to the user's preference.
    Except in IE6 where if you don't set a size on the body it gets all confused with the relative sizes within the page. Setting it is a bug fix that only affects the browser that has the bug.

    So if your page doesn't have that particular IE6 bug showing then you don't need the setting on the body. If that bug does show then adding font-size:100% to the body will fix it.

    Bug fixes are not supposed to affect other browsers that don't have the bug.


    The reason you see it in some web pages is that without it there those pages would not display correctly in IE6 (or the author is playing it safe by placing it there so that future changes can't introduce that bug into the page).
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  5. #30
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    Except in IE6
    Well, yeah I was trying to pretend such vileness doesn't exist for the sake of simplicity.

  6. #31
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,875
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by xhtmlcoder View Post
    Well, yeah I was trying to pretend such vileness doesn't exist for the sake of simplicity.
    But the question that had been asked was why bother using it when it shouldn't affect the page layout and the answer was that it is requiired to fix a bug in a particular browser. Everyone already knew that in browsers that work properly it makes no difference, the problem was that there were people who were of the opinion that it therefore should never be included whereas the only reason why anyone ought to use it is the easiest way to fix a particular bug in a particular browser.

    If you use EM to size your content and you have nested elements with different sizes specified on them then you need to set the font size on the body in order for IE6 to work all the internal sizes relative to the default rather than relative to their container.

    <div style="font-size:2em"><div style="font-size:3em">If you don't include font-size:100&#37; on the body then this text will be 6em instead of 3em in IE6</div></div>
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  7. #32
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,556
    Mentioned
    183 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by felgall
    If you use EM to size your content and you have nested elements with different sizes specified on them then you need to set the font size on the body in order for IE6 to work all the internal sizes relative to the default rather than relative to their container.

    <div style="font-size:2em"><div style="font-size:3em">If you don't include font-size:100&#37; on the body then this text will be 6em instead of 3em in IE6</div></div>
    I think you are mixing the bugs a little there

    The code you have shown above will display exactly the same in IE6 and in Firefox (assuming no user intervention).

    The reason for the font-size:100% in the body element is to do with scaling IE6 but only in relation to using keywords (or via the browser controls).

    If you don't set body to font-size:1000% and then use keywords to increase font-size or use the browser control to increase the text size then the text jumps massively on each selection.

    Setting the body to font-size:100% fixes the problem and the text will change at a reasonable size when keywords or browsers controls are used.

    Setting the body to font-size:1em causes the text to scale badly again although at a different rate to the default but still not at a usable rate and again only with keywords or browsers controls. IE7 has the same problem with all the above.

    body in order for IE6 to work all the internal sizes relative to the default rather than relative to their container.
    Percentage or em based font-sizes are always based on their parent and will compound as specified. The text on your example should be 3 times the size of the parent which is itself 2 times the default leading to text that text that will be 6 times the default size.

  8. #33
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,875
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Paul O'B View Post
    I think you are mixing the bugs a little there
    I must have misremembered it - hadn't seen it in a while. Thanks for correcting my answer.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  9. #34
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,556
    Mentioned
    183 Post(s)
    Tagged
    6 Thread(s)
    I must have misremembered it - hadn't seen it in a while.
    Yes - I had to think twice about it


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
  •