2012-12-03 39 views
0

除IE外,最内层div内的内容显示在每个浏览器上。为什么?我注意到,如果我从.absolute_container中删除overflow:hidden,那么.item中的内容会显示出来,但我需要`overflow:hidden``来保留显示原因。为什么Internet Explorer在带有溢出的div内制作内容:hidden disappear?

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; 
} 
+1

即使我已经知道你要给这个问题的答案,我仍然要问 - 所有这些div是否真的有必要? – Adam

回答

1

你需要清除.item你浮到把它放回该布局,否则父元素不知道的因素到底有多大这就是使用overflow:hidden时它消失的原因。

+0

感谢您的回复,但这不起作用。内容在IE中仍然隐蔽,但在所有其他浏览器中都可见。 –