CSS Page Centering Issue

Discussion in 'CSS' started by brian.wolfe86, Nov 9, 2008.

  1. #1
    Hi,

    I seem to be having problems centering a page using a DIV tag and CSS. The result is here:

    http://www.sentimentalweddings.com/indexy.html


    Here is the important excerpt, but I've attached both files just in case:

    CSS:

    body {
    font-size:12px;
    }
    
    #sWholeBody {
    margin:0 auto;
    text-align:center;
    }
    Code (markup):
    HTML:

    
    </head>
    
    <body>
    <div id="sWholeBody">
    	<div id="sHeader">
        	<div id="sLogo">
    ...
    </div>
    <!-- End Page Content -->
    </body>
    
    Code (markup):

    Any thoughts?


    Thanks in advance,

    Brian
     

    Attached Files:

    brian.wolfe86, Nov 9, 2008 IP
  2. garrettheel

    garrettheel Peon

    Messages:
    341
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Whatever you are using margin: 0 auto; on has to have a width defined for it to be centered. Have you applied a width?
     
    garrettheel, Nov 9, 2008 IP
  3. brian.wolfe86

    brian.wolfe86 Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Ah that did it. Thanks for the quick reply!
     
    brian.wolfe86, Nov 9, 2008 IP
  4. garrettheel

    garrettheel Peon

    Messages:
    341
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You're welcome
     
    garrettheel, Nov 9, 2008 IP