我需要 2 个重叠的 div,如下所示。
------------------------------------
| | |
| ------------------ | |
| ' '| |
| ' '| |
| ' '| |
| ' '| |
| ' '| |
| ' '| |
| ' '| |
| --------------------| |
| ' '| |
| ' '| |
| -------------------| |
| | |
| | |
------------------------------------
但不知何故我无法得到它。 here is the place am fiddling out 谁能告诉我哪里出错了。
编辑 1: 我有一个左 div 和一个右 div。左边的 div 有重叠的 div。右边的 div 是一个普通的 div。我想你们中的大多数人都感到困惑,认为右边的 div 是重叠的,左边的 div 中有 2 个 div,我需要它们重叠。
抱歉打扰了大家。
最佳答案
我想你想要这样的东西:
html
<div class="parent">
<div class="a"></div>
<div class="b"></div>
</div>
CSS
.parent {
position: relative;
}
.a {
position: absolute;
width: 100px;
height: 100px;
z-index: 100;
background: red;
}
.b {
position: absolute;
width: 80px;
height: 180px;
z-index: 110;
left: 10px;
background: blue;
top: 10px;
}
编辑:在你的例子中 parent = contentContainer, a/b = leftContainer/rightContainer
关于css - 重叠的 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3090289/