SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question IE5 / 5.5 Bug - Margin-left:auto and margin:right auto are not centering

    I found this report on this page: http://www.richinstyle.com/bugs/ie5.html

    But no possible fix was listed.

    Margin-left and margin-right
    Bug 4: auto treated as 0
    If you set margins to auto, they are replaced with 0, which is wrong when both margin-left and margin-right are auto or when either margin-left ormargin-right is set to auto and width is set to a value other than auto, or when margin-right isnot 0 and margin-left is auto.
    Now what I've done in my code is this:

    Code:
    #container{
    margin-top:0px;margin-left:auto;margin-right:auto;
    width:760px;overflow:auto;
    border-left:1px solid #ccc;
    border-right:1px solid #ccc;
    background:url('../images/grey-line-background.gif') repeat-y;}
    How can I make the container center on the page in IE 5 and 5.5?

  2. #2
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,495
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use text-align: center; to center it in IE 5.01 and 5.5.

    You may have to re-set the first child element to text-align: left; but I'm not 100% sure on that. It's been a while since I've built a fixed-width centered layout (in fact, i'm working on one right now, but haven't gotten to IE 5.x yet).

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Aha! Beautiful. Thanks so much it did the trick!


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
  •