CSSのみでボックスをセンター配置
HTML
<div id="foo">
<div id="bar">
Hello world
</div>
</div>
CSS
body {
background: #810;
margin: 0px
}
#foo{
color: #444;
background: #333;
text-align: center;
position: absolute;
top: 50%;
left: 0px;
width: 100%;
height: 1px;
overflow: visible;
visibility: visible;
}
#bar {
background: #777;
margin-left: -75px;
position: absolute;
top: -9px;
left: 50%;
width: 180px;
height: 18px;
visibility: visible;
}