为什么Internet Explorer中作出与溢出的div里面的内容:隐藏消失?(Why does

2019-08-03 12:08发布

里面的内容最内部的DIV显示在除了IE浏览器的每一个。 为什么? 我注意到,如果我删除overflow:hidden.absolute_container ,那么里面的内容.item会显示出来,但我需要'溢出:hidden``保持显示的原因。

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

Answer 1:

你需要清除您的浮动.item把它恢复成布局,否则父元素不知道的因素到底有多大,这就是为什么它使用时消失overflow:hidden



文章来源: Why does Internet Explorer make content inside a div with overflow:hidden disappear?