SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jan 2003
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Should I use ems, pixels or absolute measurements for font sizes in my CSS

    I am creating CSS for my new site and wanted to know which type of measurement for font size I should use: ems, pixels or absolute sizes eg 'small' 'x-large' etc.

    I originally did the style sheet in 'ems' because that allows the user to adjust the font size in their browser to their personal preference. However, I am generating pages within a custom built content manangement system and the ems don't work well in this. Instead of retaining their actual size they become relative to the size used further up in the page. For example, if the Ahead is 1.2ems and the Bhead style is 0.8ems, the Bhead will be 80 per cent of the Ahead rather being a fixed 0.8ems.

    I thought the solution might be to use 'absolute' measurements but these are a bit less flexible.

    Can anyone advise me on the best way forward?

    As this is my first posting, looking forward to hearing your advice.

    Catherine

  2. #2
    SitePoint Zealot wisbin's Avatar
    Join Date
    Jan 2003
    Location
    Netherlands
    Posts
    115
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Talking Nothing is sadder than the murder of a beautiful theory by a gang of ugly facts.

    ... I think you would find these articles interesting: http://www.alistapart.com/stories/fear4/5.html


    And my own answer to your question:

    - the size .em referes to the size of the parent element, if you know that you can change the child-fontsize to whatever you want
    - I think it is important to know why you want 0.8em or 1.2? I usally design with *smaller*, *normal*, and *larger* as the fontsize properties. Most of them browers have no problem with that. My design's aren't that complicated

    good luck.
    Last edited by wisbin; Jan 27, 2003 at 10:58.
    Wisbin from ict-id.nl

    Every day I see your face I wish that I'd stayed
    Don't even know what made me run away
    It's just the way I play the game
    ..


  3. #3
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Should I use ems, pixels or absolute measurements for font sizes in my CSS

    Originally posted by ctidnam
    Can anyone advise me on the best way forward?
    If you want to keep relative sizes (good idea imo) then a good idea is to apply the font-size to the element which actually contains the text. With pixels, you can set 12px on the body tag, but with realtives, better to set them on p, li, h1, h2 etc.

    Anyway, take a look at:
    http://www.thenoodleincident.com/tut...t/browser.html

    And description:
    http://www.thenoodleincident.com/tut...x.html#screens

    Douglas
    Hello World


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
  •