超级计算机囧囧囧's Archivers

From admin on 2013-05-07 22:41:23

IE6下position:absolute定位错误的bug和解决方法

例:
<style>
.test_1 {
position:relative;
margin:0 auto;
text-align:center;
width:500px;
height:300px;
background:#006600;
}
.c_1 {
position:absolute;
width:100px;
height:20px;
background:#0066CC;
}
</style>
<div class="test_1">
<div class="c_1">
</div>
</div>
解决办法:在父容器中,加入zoom:1;样式
<style>
.test_1 {
position:relative;
margin:0 auto;
text-align:center;
width:500px;
height:300px;
background:#006600;
zoom:1;
}
.c_1 {
position:absolute;
width:100px;
height:20px;
background:#0066CC;
top:0;
left:0;
}
</style>
 

查看完整版本: IE6下position:absolute定位错误的bug和解决方法

Tags: absolute


©超级计算机囧囧囧