ems, % or pixels? Which do you use?

Discussion in 'HTML & Website Design' started by typingmums, Jun 28, 2008.

  1. #1
    I've had a number of people recommend different options to me for sizing fonts in a website. Some using ems, others using % and others (which includes myself) using plain old pixels.

    Which do you use, and why...please :)
     
    typingmums, Jun 28, 2008 IP
  2. bigidea_guy

    bigidea_guy Banned

    Messages:
    518
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    ems, it will make my site look better in any browser and screen site. I guess it depends on the layout of the site.
     
    bigidea_guy, Jun 28, 2008 IP
  3. glorie

    glorie Peon

    Messages:
    123
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    For font sizes, em would be ideal. Using pixels is less troublesome than using em but if you would like your site to be accessible to most your visitors then I would suggest em. IE isn't capable of resizing text when they are declared as pixels.
     
    glorie, Jun 28, 2008 IP
  4. DeeJayEl

    DeeJayEl Peon

    Messages:
    91
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    For now, use a relative size like ems or percentages. IE6 and some other users can't resize text designated in pixels.

    This should not be an issue in the future as most modern browsers now support full page zooming.
     
    DeeJayEl, Jun 28, 2008 IP
  5. typingmums

    typingmums Well-Known Member

    Messages:
    1,446
    Likes Received:
    61
    Best Answers:
    0
    Trophy Points:
    140
    #5
    Thanks everyone!

    ems it is - I'll go and update my site now :)
     
    typingmums, Jun 28, 2008 IP
  6. xfreex

    xfreex Peon

    Messages:
    39
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    i think for ie 6 => px
    ie 7 and firefox ems ;)
     
    xfreex, Jun 29, 2008 IP
  7. rochow

    rochow Notable Member

    Messages:
    3,991
    Likes Received:
    245
    Best Answers:
    0
    Trophy Points:
    240
    #7
    To display properly across browsers, declare the first value as a percent, and then the rest as em's.

    For example:
    body {font-size:75%}
    #content {font-size:1.25em}
    #content h1 {font-size:2em}

    If you want to make sure your font size is the same including older browsers, set 76% as the font size on the body.

    If the text is in a fixed height or width box (for example: a button) where the font will bust out of the content when the font size is increased (think white text on a red button image with a white page bg - its all fine and dandy. Now jack up the font size. All of a sudden, half the text is on the white background - not that easy to read) then using plain old pixels is best.
     
    rochow, Jun 29, 2008 IP
  8. nicangeli

    nicangeli Peon

    Messages:
    828
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I use em's for font sizes, and %'s for layout. For instance, I want a wrapper div to hold all of my contents, I will specify the width to be around 90%.

    I only occasionally use px for layouts when I am creating a fixed width site, or the dimensions of a image... etc.

    Nick
     
    nicangeli, Jun 29, 2008 IP