<div class="box">
<div id="ne" class="corner"></div> <!--ne, nw, se, sw, are the corners-->
<div id="nw" class="corner"></div> <!--of first object-->
<div id="se" class="corner"></div>
<div id="sw" class="corner"></div>
<div class="box2"></div> <!--box2 is the inner border object-->
</div>
Note that for the encompassing box, ne, nw, se, sw are the inverted corners.
For box2, It is rather difficult to explain what is going on. My suggestion is to play around with the colours of the box-shadow, as well as the pixel positions, to understand how the box-shadow gives the illusion of an inverted border.
Once you get the hang of it, it's really easy to change the dimensions so that it fits your liking.
Here's a fiddle ...http://jsfiddle.net/zjw3pg2e/5/ Does this work for you?
HTML:
Note that for the encompassing box,
ne
,nw
,se
,sw
are the inverted corners.For
box2
, It is rather difficult to explain what is going on. My suggestion is to play around with the colours of the box-shadow, as well as the pixel positions, to understand how the box-shadow gives the illusion of an inverted border.Once you get the hang of it, it's really easy to change the dimensions so that it fits your liking.