码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2016-06-20 10:07:45      阅读:169      评论:0      收藏:0      [点我收藏+]

标签:

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>

 

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

标签:

原文地址:http://www.cnblogs.com/llcdbk/p/5599679.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!