Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: em vs px

  1. #1
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default em vs px

    was wondering when and where it's good to use em's instead of pixels? i have been reading up on a few books and they all use em's, especially for padding, but it seems like a lot more work than just using a pixel value... any opinions/ideas would be appreciated!

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

    Default

    Always. ems are relative units based off the user's font size which adjust themselves to the user's preferences, so they're always a better choice than pixels. However, be careful not to mix units for width.
    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!

  3. #3
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    What do you mean in the last sentecne? So your saying it's a bad idea to make a table 700px?

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

    Default

    Yes. It doesn't take account of the user's preferences, and will look drastically different (possibly spoiling your design) at different resolutions and with different font sizes.
    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!

  5. #5
    Join Date
    Jun 2006
    Location
    Acton Ontario Canada.
    Posts
    677
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    its what im using for my site right now, was getting annoyed that it was huge on the school compters or really tiny when im at home...
    Google ads dont support ems (or percents) so im stuck with the same thing...
    take a look, if you change the font size the page adapts...
    - Ryan "Boxxertrumps" Trumpa
    Come back once it validates: HTML, CSS, JS.

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

    Default

    boxxertrumps, you're serving XHTML as text/html. Don't do that, and what's the deal with "IMMA CHARGIN MA LAZER?"
    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!

  7. #7
    Join Date
    Jun 2006
    Location
    Acton Ontario Canada.
    Posts
    677
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Just random meams that the ads will read...
    Not much text on my page, so it sometimes gets off topic...

    But i keep forgetting to add the content header to the pages, thanks for reminding me.

    Quote Originally Posted by My Source
    <?php header("Content-type: application/xhtml+xml; charset=utf-8"); ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head>
    <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8"/>
    This is correct?
    - Ryan "Boxxertrumps" Trumpa
    Come back once it validates: HTML, CSS, JS.

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

    Default

    That's fine, although the <meta> is redundant.
    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!

  9. #9
    Join Date
    Jun 2006
    Location
    Acton Ontario Canada.
    Posts
    677
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Aren't headers stripped by some firewalls?
    I know the deal with xhtml, your reluctant to use it because of compatability issues...
    But i was thinking of switchingover to pure xml, so id be able to define my own elements...
    (basicly divs/spans, anchors, images and styles sheets.)
    I dont use JS or much of anything else on my site, so it would probably work...
    or i could edit the stuff i dont use out of the existing xhtml doctype declarations.
    Dont know whatthe next step is for my site.
    - Ryan "Boxxertrumps" Trumpa
    Come back once it validates: HTML, CSS, JS.

  10. #10
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    Quote Originally Posted by boxxertrumps View Post
    Originally Posted by My Source
    <?php header("Content-type: application/xhtml+xml; charset=utf-8"); ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head>
    <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8"/>

    why not just take out the php scripting then ... there really is no need for 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
  •