为什么Internet Explorer使内容在一个div内溢出:隐藏消失? [英] Why does Internet Explorer make content inside a div with overflow:hidden disappear?
本文介绍了为什么Internet Explorer使内容在一个div内溢出:隐藏消失?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
最内部div内的内容显示在每个浏览器上,除了IE。为什么?我注意到,如果我从 .absolute_container
中删除 overflow:hidden
,那么
The contents inside the inner-most div show up on every browser except for IE. Why? I've noticed that if I remove overflow:hidden
from .absolute_container
, then the contents inside .item
will show up, but I need `overflow:hidden`` to remain for display reasons.
HTML:
<tr>
<td>
<div class="relative">
<div class="absolute">
<div class="absolute_container">
<div class="relative">
<div class="item_wrap">
<div class="item">
// doesn't show up in IE
</div>
</div>
</div>
</div>
</div>
</div>
</td>
</tr>
CSS:
.relative {
position: relative;
width: 100%;
height: 100%;
}
.absolute {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.absolute_container {
position: absolute;
top: 25px;
right: 5px;
bottom: 5px;
left: 5px;
overflow: hidden;
}
.item_wrap {
overflow: hidden;
height: 16px;
font-size: 12px;
clear: right;
white-space: nowrap;
margin-bottom: 1px;
}
.item {
position: relative;
z-index: 999999;
background-color: transparent;
float: left;
}
推荐答案
在 .item
将其放回布局,否则父元素不知道元素有多大,这就是为什么当使用 overflow:hidden
。
You need to clear your float on .item
to put it back into that layout, otherwise the parent element has no idea how big the element is, which is why it disappears when using overflow:hidden
.
这篇关于为什么Internet Explorer使内容在一个div内溢出:隐藏消失?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文