div css水平垂直居中

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title></title>
    <style>
    body {
        padding: 0;
        margin: 0;
    }
    
    /*垂直居中*/
    .box {
         1200px; /*图片宽*/
        height: 650px; /*图片高*/
        position: absolute;
        left: 50%;
        top: 50%;
        margin-left: -600px;/* 宽/2 */
        margin-top: -325px; /* 高/2 */
    }
    </style>
</head>

<body>
    <div class="box">
        <img src="img/luomu_02_02.png" /> 
    </div>
</body>

</html>

@落雨
http://ae6623.cn

效果:

原文地址:https://www.cnblogs.com/ae6623/p/4758845.html