div#Foo {Just place this in positioned box and that's all.
margin: 0 auto;
left: 0;
right: 0;
width: 500px;
position: absolute;
}
But if the thing is gonna be variable width, it's a little bit more complicated.
* Put your content in a floated div, and give it a left: -50%, make it relative:
{* Put this div in another floated div, and this time with:
position: relative;
float: left;
left: -50%;
}
{
position: relative;
float: left;
left: 50%;
}
Voila.
source http://www.tightcss.com/centering/center_variable_width.htm