...

View Full Version : Centering



Jon W
10-28-2008, 11:14 AM
#top_content_container {
background-color:#fff;
width:700px;
height:100px;
}

I want to center this on the page, how would I do this without using position?

rangana
10-28-2008, 11:26 AM
#top_content_container {
background-color:#fff;
width:700px;
height:100px;
margin:auto;
}


Ensure you have a valid doctype to make it work on IE as well.

Hope that helps.

Jon W
10-29-2008, 03:01 AM
This doesn't seem to be doing the trick in my case. Maybe its something that I'm doing wrong?

body { background-image:url(/images/background5.gif);
margin-top:0px;
margin-bottom:0px;
margin-left:0px;
margin-right:0px;
}

#top_content_container {
background-color:#fff;
width:700px;
height:100px;
margin:auto;
}

BoldUlysses
10-29-2008, 03:13 AM
Give this a shot:


body { background-image:url(/images/background5.gif);
width:100%;
text-align:center;
}

#top_content_container {
background-color:#fff;
width:700px;
height:100px;
margin:0px auto;
}

Jon W
10-29-2008, 03:19 AM
Yes this works. Thanks again guys for you help. :)

Jon W

abduraooft
10-29-2008, 08:21 AM
body { background-image:url(/images/background5.gif);
width:100%;
text-align:center;
}


Yes this works. Thanks again guys for you help.

Jon W You are running in quirks mode! Add/change your doctype and switch your document in to a standard one.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum