css垂直水平居中box

 

 

<!DOCTYPE html>
<html>
<head>
    <meta  charset="utf-8" />
    <title>css绝对定位垂直水平居中box</title>
</head>
    <body>
        <div style="width:100%; height:100%; background-color:#CCC; ">
        <div style="width:100px; height:100px; position:absolute; top:50%; background-color:#00C; left:50%; margin-top:-50px; margin-left:-50px;">swf</div>
        </div>
    </body>
</html>

 

 

 

posted @ 2012-10-17 11:59  playerlife  阅读(582)  评论(0编辑  收藏  举报