ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Center Site

February 25, 2012 6:43am

Subscribe [3]
  • #1 / Feb 25, 2012 6:43am

    turnstile

    68 posts

    how do i center my site?  it’s on the left side and i want it in the middle.

    thanks,

    Peter

  • #2 / Feb 26, 2012 7:54am

    Sean C. Smith

    3818 posts

    Hi Peter,

    Typically centering a site is done with a combination of html and css. To do this you would wrap all of your code inside the body tag with a another div like this:

    <html>
     <head>
     </head>
     <body>
      <div id="wrapper">
        your site code here
      </div>
     </body>
    </html>

    In the CSS file for your site you would then add this:

    #wrapper {
      width: 960px; 
      margin: 0 auto; 
    }

    Does that help?

    Sean

  • #3 / Feb 26, 2012 11:15pm

    turnstile

    68 posts

    i don’t get it…what tells it to center?  i already have that code in the page & it doesn’t work.

  • #4 / Feb 27, 2012 5:41am

    Mark Bowen

    12637 posts

    You’re going to have to provide us with the code you’re currently using or a link to the page in question or this will not be very easy to troubleshoot! 😉

    What Sean has shown above definitely works so we need to see where it’s not working for you.

    Best wishes,

    Mark

  • #5 / Feb 27, 2012 2:15pm

    turnstile

    68 posts

  • #6 / Feb 27, 2012 3:16pm

    Mark Bowen

    12637 posts

    I can’t see any margin: 0 auto; in your stylesheet anywhere. Have you tried as was suggested above?

    I would suggest making a brand new blank template and just literally placing the code shown above and getting things working like that so you can see what is going on. Then you can try working your code around it.

    Best wishes,

    Mark

  • #7 / Feb 27, 2012 4:28pm

    Shane Eckert

    7174 posts

    Hello

    Sean’s CSS will do the job for you. And Mark has a great suggestion. Thanks Mark!

    If these do not work, please let us know. We will do our best to help you out!

    Cheers,

     

  • #8 / Feb 27, 2012 8:41pm

    turnstile

    68 posts

    Doh!  you’re right Sean.  I had the margin parameter somewhere else & thought it was good enough, it wasn’t.  Thank you guys, you rock once again!  😊

  • #9 / Feb 28, 2012 1:50pm

    Shane Eckert

    7174 posts

    Hello turnstile,

    I am glad we could help.

    Happy coding!

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases