微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

css – 重叠div

我需要2个重叠的div,看起来像下面的那个.
------------------------------------
   |                      |             |
   |   ------------------ |             |
   |  '                  '|             |
   |  '                  '|             |
   |  '                  '|             |
   |  '                  '|             |
   |  '                  '|             |
   |  '                  '|             |
   |  '                  '|             |
   |  --------------------|             |
   |  '                  '|             |
   |  '                  '|             |
   |   -------------------|             |
   |                      |             |
   |                      |             |
    ------------------------------------

但不知怎的,我无法得到它. here is the place am fiddling out
谁能告诉我哪里出错了.

编辑1:
我有一个左div和一个右div.左边的div有重叠的div.右边div是普通的div.我猜大多数人都很困惑,而正确的div是重叠的,左边有两个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

原文地址:https://www.jb51.cc/css/215968.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。