2008/8/30 土曜日

DIV領域を上下左右中央に設置するCSS・HTMLコード

Filed under: 開発メモ — admin @ 22:05:08

<style type=”text/css”>
body {
background:#ccc;
margin:0;
padding:0;
}
#wrap {
position:absolute;
width:500px;
height:100px;
left:50%;
top:50%;
margin-left:-250px;
margin-top:-50px;
background:#fff;
color:#999;
}
</style>

■HTML

<body>
<div id=”wrap”>locate div at the center vertically and horizontally.</div>
</body>

HTML convert time: 0.124 sec. Powered by WordPress ME