有相对定位和overflow:hidden存在的时候,父级包不住子级

<div class="box">
    <div class="content"></div>
</div>

.box{
    width: 200px;
    height: 200px;
    border: 2px red solid;
    overflow: hidden;
}
.content{
    width: 200px;
    height: 200px;
    background: red;
    position: relative;
}

这个时候在IE6,7下你会发现overflow: hidden失效了;
解决方案:

.box{
    width: 200px;
    height: 200px;
    border: 2px red solid;
    overflow: hidden;
    *position: relative;
}

猜你喜欢

转载自blog.csdn.net/qq_36800701/article/details/79859723
今日推荐