html - 显示 : table and overflow: hidden in Firefox and IE 的不正确行为

标签 html css internet-explorer firefox

我将使用这样的标记:http://jsfiddle.net/g6fo2grs/

因此,主要问题出在第二个 div 中包含的绝对定位伪元素“before”中。如果它大于容器,我正在使用 overflow: hidden 来隐藏它,我在 Firefox 和 IE 上遇到问题,因为这种样式不适用于 display: table 样式.我应该使用它,因为第二个 div 可以包含不同数量的不同大小的内部 div,并且它们应该被拉伸(stretch)到第二个 div 的宽度。这就是为什么我使用 display: table-cell 但如果没有 display: table 作为三分之一的 div,它就无法工作。而且我要支持IE8+所以不能用flex。最后,我无法向该标记添加新元素,也无法用 div 替换伪元素。

最佳答案

clip 属性不能解决您的问题,因为“表格”具有固定大小吗?

.second:before {
    /*
    all other styles unchanged
    */
    clip: rect(25px 552px 77px 50px);
}

参见示例:http://jsfiddle.net/g6fo2grs/4/

顺便说一下,您在示例中使用的一些功能(例如 rgba() color 和 border-radius)已经与 IE8 不兼容。

关于html - 显示 : table and overflow: hidden in Firefox and IE 的不正确行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31315080/

相关文章:

javascript - 使用 javascript 将 CSS 类随机附加到一个列表项

javascript - event.returnValue 在 IE7 中给我一个错误

html - IE 中显示的菜单

html - 使用 CSS3 的带有倾斜边框的 Div?

javascript - 如何从根域访问子域的html5 localStorage?

html - 何时在 html/css 中使用 id 和 class

html - 单选按钮在 ie 和 chrome 中消失

javascript - 如何将漂亮的json格式嵌入到html静态页面?

html - 如何从 NSString 的特定位置删除子字符串?

javascript - 打开另一个时关闭一个 div