Grow your CSS skills. Land your dream job.

Centering Wrapper in Browser

  • # May 22, 2009 at 5:36 pm

    I have a web page at http://www.biom.net/index.php/dojo/index/ and as you can see it’s flush left in the browser. I want to center it and have tried adding “auto” to the margin element for both body and wrapper selectors, but can’t get the setting to budge.

    Can you point out where I’m off?

    Code:
    #wrapper {
    position: relative;
    float: left;
    margin: 0 auto;
    padding: 0;
    width: 778px;
    background: #cccc99;
    color: #333;
    border-top: 10px solid #000;
    }

    Thanks.

    # May 22, 2009 at 6:59 pm

    Is it because of the Float:Left in your code? Does that need to be there?

    # May 22, 2009 at 9:48 pm
    "Preeminent" wrote:
    Is it because of the Float:Left in your code? Does that need to be there?

    Good eye Preeminent. Dumping the float fixed it.

    Thanks!

    Ramone

    # May 23, 2009 at 12:33 am

    btw, that may not work in IE6 unless the parent element has

    Code:
    text-align:center

    :geek:

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

You must be logged in to reply to this topic.

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