Edit in JSFiddle


              
            
          
            
              
                
<div style="background-color:green; width:50px;">
    before A
</div>
<div style="margin:50px 0; background-color:green; width:50px;">
    <div style="margin:-60px 0;">
           <div style="margin:150px 0;">A</div>
    </div>
</div>
<div style="margin:-100px 0; background-color:green; width:50px;">
    <div style="margin:-120px 0;">
           <div style="margin:200px 0;">B</div>
    </div>
</div>
<div style="background-color:green; width:50px;">
    after B
</div>