您的位置:首页 > 其它

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

2014-09-25 12:40 260 查看
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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: