Page 1 of 1

centering a webpage with css [solved]

Posted: Thu Dec 14, 2006 10:30 pm
by s.dot
I've done this before, I just can't seem to remember how. I have a main div that is 760px wide.. i just want it in the center.

I've tried this:

Code: Select all

body, html {
	margin: 20px auto 10px auto;
	padding: 0 auto 0 auto;
	text-align: center;
}
And this:

Code: Select all

body, html {
	margin: 20px 0 10px 0;
	padding: 0 0 0 0;
	text-align: center;
}
Both work in IE, but not in FF or Opera.

Posted: Thu Dec 14, 2006 10:33 pm
by Burrito
you need the margin property set to '0 auto' in a container div.

Code: Select all

#container {
  border:1px #000000 solid; margin:0 auto;
}

Posted: Thu Dec 14, 2006 10:49 pm
by s.dot
You da man, burrito. :D