I am trying to create a loading overlay on top of tbody (and only tbody). My current solution is to add tr as the last element of tbody and set it as position: absolute, and setting tbody as position: relative.
table {
width: 100%;
}
tbody {
position: relative;
}
.overlay {
position: absolute;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(200, 200, 200, 0.7);
}
<table>
<thead>
<tr>Label</tr>
</thead>
<tbody>
<tr><td>Data</td></tr>
<tr><td>Data</td></tr>
<tr class="overlay">
<td>My overlay</td>
</tr>
</tbody>
</table>
Expected behavior is that an overlay covers tbody, but not thead. Also this overlay is supposed to contain some content (f.e. refresh button) so covering every td is not an option.
My solution works perfectly in Firefox, but not webkit. Webkit somehow ignores position: relative on tbody tag and thus the overlay covers the whole table and more.
RESOLVED I have managed to make this approach work by adding display: table on tbody