tags:

views:

48

answers:

2
html, body {margin: 0px; padding: 0px;}

#pageContainer{ margin: auto; padding: auto;}
#contentContainer{ margin:150px; width:1100px; height: 100%; overflow: hidden; }
#leftContainer{ width: 80%; min-height: 800px; background: #009900; float:left;}
#left1{ margin:80px 0 0 80px; height: 550px; top:0px; z-index:1; background: #000000;}
#left2{ margin:80px 0 0 80px; height: 500px; top:110px; z-index:2000; background:#99FFFF; }
#rightContainer{ width: 20%; height: inherit; background: black; float:right;}

/ CSS Document */

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

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


<div id="pageContainer">
  <div id="contentContainer">
    <div id="leftContainer"> Am the left container 
      <div id="left1"> 
          <div id="left2">
          </div>
      </div>
    </div>
    <div id="rightContainer">

    </div>
  </div>
</div>

The problem is am failing to get the overlap. Where am I going wrong?

Edit 1: topx was a typo, corrected it.

+4  A: 

You need to use position: relative (absolute or fixed work as well but they will give you different results) to get them to overlap as stated at W3Schools. You need to add them to #left1 and #left2. It should be left or top, there is no topx.

You can fiddle with it here at jsfiddle.

sirhc
Thank you for the resource, it's fantastic :-)
Chaitanya
A: 

try position:absolute;

rabidmachine9