treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Centering Wrapper in Browser

  • 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?

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


    Thanks.
  • Is it because of the Float:Left in your code? Does that need to be there?
  • "Preeminent" said:
    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
  • btw, that may not work in IE6 unless the parent element has
    text-align:center
    :geek: