Grow your CSS skills. Land your dream job.

IE 7 Centering

  • # June 1, 2009 at 11:52 pm

    trying to center my page layout in IE 7.

    works fine in Safari, Firefox, Opera with the following :

    body {
    margin: 0 auto;
    min-width: 990px;
    width: 990px;
    background: #000000 url(../images/bg.jpg);
    background-position: 50% 0;
    background-repeat: repeat-y;
    padding:0;
    font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
    font-size: 13px;
    }

    but I can’t seem to get it to center properly in IE 6/7

    any ideas?

    cheers,

    zanuka

    # June 2, 2009 at 3:34 am

    Add

    Code:
    html { text-align:center;}

    You need that on your parent element to get margin: 0 auto; to work in IE.

    Then you need "text-align:left;" on your <body> tag to make your text align left again.

    (Although, I would not use your body as your page outline, I would make a <div ID="container"> or something similar.)

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".