How do I center my website?

User 372473 Photo


Registered User
1 post

My site address is http://www.gbgm-umc.org/marshltn/index.html

I cannot, for the life of me, figure out how to center it so that it doesn't all swing over to the left on the new rectangular monitors. I took over this site from someone else about 4 years ago and had to teach myself how to add to it. I think I've overcome a lot and learned a lot, but centering the whole site seems to be a losing battle. There is a CSS stylesheet. Is that where I have to change code?

Thanks so much for any help anyone can give!! - Linda
User 462238 Photo


Registered User
144 posts


CSS. Is your website wrapped in an outer div that contains the site.

#outerWrapper {

width: XXXXpx
margin: 0px auto 0px auto;}

Should center it if it is applied to the outer wrapper if it exists in the CSS
User 122279 Photo


Senior Advisor
14,649 posts

Hi Linda,

Add this to the top of your style sheet:
body{
margin: auto;
}
table {
width: 880px;
margin: auto;
}

The 'margin auto' is what centers the page. I've added the width for the table because I discovered that in IE the last menu item dropped down to the line below.
Whoever created the style sheet used a 'class' body (.body) for something else than the actual <body> of the document. That my be confusing. The correction I made above has to do withy the document body.
Ha en riktig god dag!
Inger, Norway

My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com



Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.