首页 > 其他 > 详细

让一个div在不同的显示器中永远居中

时间:2016-03-03 19:20:25      阅读:259      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <style>
        .center_box{
            width: 80%;
            height: 50%;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
        }
    </style>
</head>
<body>
    <div class="center_box" style="border: 1px solid #f00; ">hhhhh</div>
</body>
</html>

 

让一个div在不同的显示器中永远居中

原文:http://www.cnblogs.com/darkterror/p/5239645.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!