CSS3 div水平、垂直居中,IE9以上、Firefox、Chrome均正常

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>水平、垂直居中Div</title>
    <meta charset="utf-8" />
    <style>
        .CenterBox {
            position: fixed;
            top: 40%;
            left: 50%;
            background-color: #eee;
            border-radius: 15px;
            padding: 15px;
            width: 350px;
            -webkit-transform: translateX(-50%) translateY(-50%);
            -moz-transform: translateX(-50%) translateY(-50%);
            -ms-transform: translateX(-50%) translateY(-50%);
            transform: translateX(-50%) translateY(-50%);
        }
    </style>
</head>
<body>
    <div class="CenterBox">
        asd
    </div>
</body>
</html>
原文地址:https://www.cnblogs.com/ZC_Mo-Blog/p/5436811.html