css - 为什么 Internet Explorer 在溢出 :hidden disappear? 的 div 中制作内容

标签 css internet-explorer

最里面的 div 中的内容会显示在除 IE 之外的所有浏览器上。为什么?我注意到,如果我从 .absolute_container 中删除 overflow:hidden,那么 .item 中的内容将会显示,但我需要` overflow: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;
}

最佳答案

您需要清除 .item 上的 float 以将其放回该布局,否则父元素不知道该元素有多大,这就是使用 时它消失的原因溢出:隐藏

关于css - 为什么 Internet Explorer 在溢出 :hidden disappear? 的 div 中制作内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13690700/

相关文章:

html - css 无需编辑周围的 HTML

javascript - IE 中的 HTAccess 使用 javascript 或 jquery

html - Internet Explorer 中的垂直滚动条

html - 如何在 IE 的表格单元格中将 html 选择元素 css 高度设置为 100%?

firefox - 多个 CSS 背景,图像上的颜色,被忽略

css - 使位置 : absolute div go behind its position: relative parent

CSS3定位/高度问题

javascript - 在另一个图像上添加图像作为按钮

internet-explorer - Internet Explorer 中 "Browser Mode"和 "Document Mode"之间的区别

javascript - 有没有办法在 ie9+ 中实现 promise