重叠div [英] Overlapping divs

查看:98
本文介绍了重叠div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要2个重叠的div,如下所示。

  ---------- -------------------------- 
| | |
| ------------------ | |
| ''| |
| ''| |
| ''| |
| ''| |
| ''| |
| ''| |
| ''| |
| -------------------- | |
| ''| |
| ''| |
| ------------------- | |
| | |
| | |
------------------------------------

但是无论如何我无法得到它。 这里是摆出来的地方
任何人都可以告诉我我在哪里错了。 p>

编辑1:
我有一个左div和一个右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


I require 2 overlapping divs, which look like the one below.

    ------------------------------------
   |                      |             |
   |   ------------------ |             |
   |  '                  '|             |
   |  '                  '|             |
   |  '                  '|             |
   |  '                  '|             |
   |  '                  '|             |
   |  '                  '|             |
   |  '                  '|             |
   |  --------------------|             |
   |  '                  '|             |
   |  '                  '|             |
   |   -------------------|             |
   |                      |             |
   |                      |             |
    ------------------------------------

But somehow am unable to get it. here is the place am fiddling out Can anyone tell me where am I going wrong.

Edit 1: I have a left div and a right div. The left div has the overlapping div. Right div is a normal div. I guess most of you are confused and thing the right div to be the overlapping one, there are 2 divs in the left div i need those to overlap.

Sorry to confuse you all.

解决方案

I think you want something like this:

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;
}

Edit: in your case parent = contentContainer, a/b = leftContainer/rightContainer

这篇关于重叠div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆