我有3个级别div:
- (下面的绿色)
div带有的顶层overflow: hidden。这是因为我希望如果该框内的某些内容(此处未显示)超出框的大小,则会对其进行裁剪。 - (在下面红色)这里面,我也
div有position: relative。唯一的用途是用于下一个级别。 - (下面的蓝色)最后,
div我从流程中取出,position: absolute但要相对于红色div(而不是页面)进行定位。
我希望将蓝色框从流程中移出并扩展到绿色框之外,但要相对于红色框定位,如下所示:

但是,使用下面的代码,我得到:

并移除position: relative红色框上的,现在允许蓝色框脱离绿色框,但不再相对于红色框定位:

有没有办法:
- 将保持
overflow: hidden在绿色框上。 - 蓝色框是否已超出绿色框并相对于红色框定位?
完整资料:
#d1 {
overflow: hidden;
background: #efe;
padding: 5px;
width: 125px;
}
#d2 {
position: relative;
background: #fee;
padding: 2px;
width: 100px;
height: 100px;
}
#d3 {
position: absolute;
top: 10px;
background: #eef;
padding: 2px;
width: 75px;
height: 150px;
}
<br/><br/><br/>
<div id="d1" >
<div id="d2" >
<div id="d3"></div>
</div>
</div>
position: fixed将忽略overflow:hidden任何包含元素的。
