SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    May 2009
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,380
    Mentioned
    180 Post(s)
    Tagged
    6 Thread(s)
    Hi,

    Have you got a full modern doctype on your page otherwise IE will go into quirks mode and won't center in the normal way?

  3. #3
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,214
    Mentioned
    457 Post(s)
    Tagged
    8 Thread(s)
    There's nothing wrong with that code, so something else on the page is throwing it out. Could you post your whole page? Do you have a doctype declaration at the top of the page?

    EDIT: oops, got shot at high noon.

  4. #4
    Non-Member bronze trophy
    Join Date
    Nov 2009
    Location
    Keene, NH
    Posts
    3,760
    Mentioned
    23 Post(s)
    Tagged
    0 Thread(s)
    With the crowd on checking for a doctype -- but... stupid question...

    Is #content_wrapper a div or other block-level container?

    Some observations -- you should NEVER set px as the font size on body since you just shtupped accessibility, if you set the font-size you shouldn't trust the default line-height so get that in there, at which point you might as well use the condensed font property. 1000px is also NOT 1024 friendly as you should be taking 32 to 48px off of that (I use 48 to be on the safe size) -- so you're working on something that's not even 1024 friendly cross-browser...

    ... and condensing your css to single lines and including all those spaces make it hard to tell what's attributes and values.

    ANYTHING we tell you though just from that CSS is wild guesses -- CSS without the markup it's applied to is gibberish; and a snippet cannot possibly tell us the whole story as it could be any number of other things in your document interfering with this.


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
  •