css垂直水平居中box

<!DOCTYPE html>
<html>
<head>
    <meta  charset="utf-8" />
    <title>css绝对定位垂直水平居中box</title>
</head>
    <body>
        <div style="100%; height:100%; background-color:#CCC; ">
        <div style="100px; height:100px; position:absolute; top:50%; background-color:#00C; left:50%; margin-top:-50px; margin-left:-50px;">swf</div>
        </div>
    </body>
</html>
原文地址:https://www.cnblogs.com/playerlife/p/2727470.html