HTML and CSS rely on a strict set of certain logic and, unfortunately, have no way to arrange the contents of the element and its background through z-index independently and intertwine them with different elements (as far as I know, m is known).
Here is one proposed method, it is not the most ideal of solutions, but sometimes violating the rules, includes pollution. Apply a shadow to each of your li elements and shift the shadow depending on which element it is on the list: top, bottom, or any element between them.
HTML
<ul> <li><div>Elephant</div></li> <li><div>Monkey</div></li> <li><div>Snake</div></li> <li><div>Zebra</div></li> </ul>
CSS
li { overflow:hidden; height:30px; } li div { box-shadow : inset 0px 0px 10px #000000; -ms-box-shadow : inset 0px 0px 10px #000000; -moz-box-shadow : inset 0px 0px 10px #000000; -webkit-box-shadow : inset 0px 0px 10px #000000; line-height:30px; height:30px; margin-top:-30px; padding:30px 10px; } li:first-child div { margin-top:0; padding-top:0; padding-bottom:60px; } li:last-child div { margin-top:-60px; padding-top:60px; padding-bottom:0; }
You can see the full code and demo on the following jsFiddle and it seems to work fine in Firefox 11 and IE9, but can't guarantee for other browsers.
source share