为什么我的div在Internet Explorer中消失了?

时间:2012-12-08 04:06:35

标签: html css internet-explorer

  

可能重复:
  Why does Internet Explorer make content inside a div with overflow:hidden disappear?

<div class="item">内的内容在Internet Explorer中消失,但在所有其他浏览器中都可见。为什么?此问题是之前问题的修改版本,从未收到答案。也许我的修改使我更接近可能的解决方案?

HTML:

<td class="table_class">
    <div class="relative">
        <div class="relative">
            <div class="absolute">
                <div class="item_container">
                    <div class="item">
                        // there may be several of these divs
                    </div>
                </div>
            </div>
        </div>
    </div>
</td>

CSS:

.table_class {
    vertical-align: top;
    position: relative;
    z-index: 2;
    padding: 0;
}

.relative {
    height:100%;
    width:100%;
    position:relative;
}

.absolute {
    position: absolute;
    top: 25px;
    right: 5px;
    bottom: 5px;
    left: 5px;
    overflow: hidden;
}

.item_container {
    height: 16px;
    font-size: 12px;
    clear: both;
    white-space: nowrap;
    margin-bottom: 1px;
}

.item {
    position: relative;
    z-index: 999999;
    background-color: transparent;
    float: left;
    text-align: left;
    clear: both;
}

我错过了什么? (是的,需要两个div = class =“relative”)。

1 个答案:

答案 0 :(得分:0)

您应该尝试将widthheight添加到.absolute CSS类。

为什么您的.item课程同时包含float: left;clear: both;

我建议删除clear: both属性,然后将同级div添加到您的item div,并将样式clear: both添加到其中,如下所示:

<div class="item_container">
    <div class="item">
        // there may be several of these divs
    </div>
    <div style="clear: both;"></div>
</div>

如果这不起作用,请尝试将widthheight添加到.item课程。