码迷,mamicode.com
首页 > 其他好文 > 详细

IE6下position解决父元素被撑开的问题

时间:2015-01-21 13:03:28      阅读:81      评论:0      收藏:0      [点我收藏+]

标签:

在IE6下面当子元素的宽度/高度大于父元素时, 父元素的宽度/高度就被撑开.IE7以上是不会被撑开的

<style>
.f{width:100px; height:100px; background:#808080}
.s{width:50px; height:150px; background:#4cff00;}
</style>
<div class="f">
    <div class="s"></div>
</div>

为了使IE6和其他的浏览器行为一致,我们可以在子元素中添加postion来解决问题

<style>
.f{width:100px; height:100px; background:#808080; _overflow:hidden;}
.s{width:50px; height:150px; background:#4cff00;_position: relative;}
</style>
<div class="f">
    <div class="s"></div>
</div>

 

IE6下position解决父元素被撑开的问题

标签:

原文地址:http://www.cnblogs.com/answercard/p/4238478.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!