首页 > 其他 > 详细

两种方法实现盒子居中----以“回”字为例

时间:2017-01-24 10:55:12      阅读:189      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
*{
padding:0;
margin:0;
}
.box1 {
position: absolute;
top: 50%;
left: 50%;
width: 400px;
height: 300px;
border: 50px solid #000;
margin: -200px auto auto -250px;
}
.box2{
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
width: 150px;
height: 100px;
border: 50px solid #000;
}
</style>
</head>
<body>
<div class="box1">
<div class="box2">
</div>
</div>
</body>
</html>

两种方法实现盒子居中----以“回”字为例

原文:http://www.cnblogs.com/qiancheng123/p/6346500.html

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