centering a webpage with css [solved]

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

centering a webpage with css [solved]

Post 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.
Last edited by s.dot on Thu Dec 14, 2006 10:49 pm, edited 1 time in total.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post 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;
}
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

You da man, burrito. :D
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Post Reply