Example fiddleChrome有错误,用CSS夹嵌套的div
我有这样的HTML:
<div class="parent">
<div class="child"></div>
</div>
而这样的CSS:
.parent {
position: absolute;
width: 100px;
height: 100px;
background: red;
}
.child {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
clip: rect(auto auto auto 100px);
background: green;
}
所以家长通过孩子完全重叠。在FF中我可以看到父项,但在铬中它是不可见的。但是,如果我正在设置,例如,left:1px
给孩子,父母即刻出现。我怎样才能避免这个错误?
其实,一个好主意。适合我的真实情况。我仍然对解决这个问题的其他方式感兴趣,但这只是一个学术目的,所以接受这个答案。 –