Two divs with shadows looks like one part. Is it possible in CSS?

css

Solution

This is the best I could get within a couple of minutes, I think it does the job. The best thing is its simplicity (only 3 edits to your css)

Position D1's shadow so the right edge has a negative value (-4px is enough to hide it)

Give both divs relative positioning so we can control their stacking order.

Give D1 a higher z-index than D2 so it masks the top part of D2's shadow.

#one {
    width: 100px;
    height: 100px;
    background: #FFF;
    -moz-box-shadow: -4px 0 3px 1px rgba(0,0,0,0.3);
    -webkit-box-shadow: -4px 0 3px 1px rgba(0,0,0,0.3);
    box-shadow: -4px 0px 3px 1px rgba(0,0,0,0.3);
    float:left;
    position: relative;
    z-index: 20;
}
#two {
    width: 100px;
    height: 300px;
    background: #FFF;
    -moz-box-shadow: 0 0 3px 1px rgba(0,0,0,0.3);
    -webkit-box-shadow: 0 0 3px 1px rgba(0,0,0,0.3);
    box-shadow: 0 0 3px 1px rgba(0,0,0,0.3);
    float:left;
    z-index: 5;
    position: relative;
}

Problem

I have two divs next to the each other which background color is white. http://jsfiddle.net/J5ZXt/ is link to code. I want that two divs look like one element, so I need to remove a part of shadow. Any ideas?

Original source

Related problems