您的位置:首页 > 其它

如何使能DIV垂直和水平居中

2012-01-26 17:33 246 查看
<style type="text/css">

.center-middle1 {

position:absolute;

background-color: #e2e2e2;

width: 100%;

height: 300px;

top:50%;

margin-top: -150px; }

.center-middle2 {

position:absolute;

background-color: #e2e2e2;

width: 300px;

height: 200px;

left:50%;

top:50%;

margin-left: -150px;

margin-top: -100px; }

</style>

用例:

<div class="enter-middle2">

如何使能DIV垂直和水平居中

</div>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: