I am struggling to create an HTML table with proper vertical spacing between rows and a shadow effect beneath each row.
Unfortunately, the shadow always ends up overlapping other table content.
I have tried adjusting the positioning of elements and setting z-index values without success.
https://i.sstatic.net/T3dlL.png
table {
border-collapse: separate;
border-spacing: 0;
}
td,
th {
min-width: 170px;
}
.shadow {
position: relative;
z-index: 1;
margin: 2px 0 2px 0;
}
<span class="unique">.shadow:before {
content: "";
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: -1;
box-shadow: 0 0 10px 10px #000;</span>
<main>
<table>
<thead>
<tr>
<td>head</td>
<td>head</td>
<td>head</td>
</tr>
</thead>
<tbody>
<tr>
<td><div class="shadow">div</div></td>
<td><div class="shadow">div</div></td>
<td><div class="shadow">div</div></td>
</tr>
<tr>
<td><div class="shadow">div</div></td>
<td><div class="shadow">div</div></td>
<td><div class="shadow">div</div></td>
</tr>
<tr>
<td><div class="shadow">div</div></td>
<td><div class="shadow">div</div></td>
<td><div class="shadow">div</div></td>
</tr>
</tbody>
<tfoot>
<tr>
<td>foot</td>
<td>foot</td>
<td>foot</td>
</tr>
</tfoot>
</table>
</main>