DIV在另一个DIV里面垂直居中,水平居中

HTML:

 <div class="parent">
        <div class="children">
            <div class="close">
                <img src="image/ico/icon-close.png" />
            </div>
        </div>
    </div>

CSS:

   <style type="text/css">
        .parent {
            width:800px;
            height:800px;
            background:#286921;
             position:relative;
        }
        .children {
            border:3px #fff solid;
            width:80px;
            height:80px;
            margin:auto;
            top: 0; left: 0; bottom: 0; right: 0; 
            position: absolute;  
        }
        .close {

        }
    </style>

 

posted @ 2016-06-20 09:48  洛晨随风  阅读(2049)  评论(0编辑  收藏  举报