Skip to content Skip to sidebar Skip to footer

Overlapping Divs

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

Solution 1:

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


Solution 2:

I have changed like this:

#rightContainer {
    /*float:right ;*/
    width:20%;
    /*margin:0px;*/
    margin-top: 30px;
    margin-left: 30px;
    padding:0px;
    position:relative;
    background-color:Lime;
}

You may change the "30px" as you like. I have tested in FireFox only.


Solution 3:

You will have to use top, left and z-index properties for that.


Solution 4:

Im not really sure how to use the z-index

But i think this might help in the style tag

margin:-50px -50px 0px 0px;

the minus property works, how well it does should be all about testing


Post a Comment for "Overlapping Divs"