首页 > 其他 > 详细

盒子模型上下左右居中方法总结

时间:2014-09-25 13:46:30      阅读:194      评论:0      收藏:0      [点我收藏+]

1.采用负边距和position结合方式

<html>
<head></head>
<body>
<style type="text/css">
.big{
position:relative;background:#eee;
width:100%;height:100%;
}
.small{
position:absolute;top:50%;left:50%;
width:200px;height:200px;border:1px solid red;
margin:-100px 0 0 -100px;background:#fff;
}
</style>
<div class="big">
  <div class="small">盒子居中</div>
</div>
</boyd>
</html>

 

盒子模型上下左右居中方法总结

原文:http://www.cnblogs.com/bigdesign/p/3992549.html

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