Results 1 to 2 of 2

Thread: need help with css margin

  1. #1
    Join Date
    Oct 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default need help with css margin

    hi
    I am trying to put content_wrapper div in the center of the browser. It works for Chorme, Firefox, Opera, safari but it does not work for IE 8. Here is my css
    Code:
    body { font-size: 12px; font-family: Arial, Helvetica, sans-serif }
    #content_wrapper { width: 1000px; margin: 0 auto; border: 1px solid #000000 }
    Help Please

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Using margin: 0 auto; when specifying the width is the way to do it. In IE though this also requires a standards invoking DOCTYPE. I usually use the HTML 5 DOCTYPE. You can use any of the standards invoking DOCTYPES that can apply to your page that are covered here (the HTML 5 one is first):

    http://www.javascriptkit.com/howto/doctype.shtml

    In case you don't already know, a DOCTYPE is the very first thing in the HTML source code of a page, right before the opening <html> tag, even before any comments. It tells the browser certain things about how to render the page. It tells some browsers more things than others (example IE), but it tells all browsers some things. So the rest of your page may or may not render differently after invoking standards. If it does, it's generally better to fix that than to revert to non-standard (Quirks) mode, as quirks vary much more widely among browsers than do standards.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •