绝对定位居中布局

<!DOCTYPE html>
<html>

    <head>
        <meta charset="UTF-8">
        <title></title>
        <style type="text/css">
            html,
            body {
                height: 100%;
            }
            
            .div {
                position: absolute;
                /*height: 200px;*/
                width: 800px;
                background: yellow;
                margin: 0 auto;
                top: 0;
                left: 0;
                bottom: 0;
                right: 0;
                /*margin-top: -100px;*/
            }
        </style>
    </head>

    <body>
        <div class="div"></div>
    </body>

</html>

 

posted @ 2017-09-04 20:41  蓝色帅-橙子哥  阅读(469)  评论(0编辑  收藏  举报