dcsimg
www.webdeveloper.com
Results 1 to 6 of 6

Thread: EM's versus pixels

  1. #1
    Join Date
    Jun 2005
    Posts
    35

    EM's versus pixels

    Hi

    I'm designing a site at the moment, and have been told that i should use em's for font sizes rather than pixels.

    Is this correct? And if it is, what are the advantages of using EM's and the disadvantages (if there are any).

    Thanks a lot

  2. #2
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    At least 98% of internet users' DNA is identical to that of chimpanzees

  3. #3
    Join Date
    Feb 2005
    Location
    England, derbyshire
    Posts
    5

    ems

    ems are a general measurement that can be read by different sized screen and browsers etc and interpreted by the output media to give it a size relative to that media. Pixels however are a strict measurement (as you know). If you are to assign pixels to fonts then different sized screen and browsers will distort the text in weird ways usually by squashing it untill it is no longer readable. The cases in which this happens however would be few but you never know who is viewing your site and on what so to be on the safe side use ems for your fonts. Its all to do with accessability so it is an important thing to take note of in the future! hope this helps!

  4. #4
    Join Date
    Mar 2005
    Location
    Sydney, Australia
    Posts
    7,974
    Using EMs means that if your visitor needs to make the text bigger so they can read it they can. Using pixels means that the text will display using the specified number of pixels regardless of what the user wants. If their screen is set to 1000 pixels to the inch (no screen resolution goes this high yet but it could be soon) then the text would be microscopic. Even points is a better choice than pixels since at least it is independent of screen resolution although not changable by visitors without overriding the whole stylesheet.
    Stephen

  5. #5
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    22,080
    Note that an em by itself is meaningless; it's size is coupled to the applicable font size of the element in question. If the current font size is 12px or 15pt or 0.2in, then the em will be roughly that size (12px, 15pt, or .02in)*. Then if the user increases/decreases the font size of his browser display, any elements using em units for any dimensions should have those dimensions increased/decreased in proportion to the new font size.

    If you assign a font-size of 2em, then that means the font-size for that element will be twice the size of its default font.

    ____________
    * The name "em" comes from the dimensions of a capital "M" within a given font style and size.
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  6. #6
    Join Date
    May 2004
    Location
    dobson ave.
    Posts
    694
    Hi -
    Call me crazy, but I usually set font-size:100%; in the body css, then set it from there in following elements - which may not be the greatest choice, but at least no matter what the user has it set for, the text will be proportional. [Line-heights I do w/ em's, tho - and letter-spacing in px.]

    El
    F-fox 2.0 :: US :: el design site :: 768 kbps :: WIN

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles