I am attempting to implement a loading overlay specifically on top of the tbody element. My current method involves adding a tr as the last child of tbody and positioning it using position: absolute, while setting the parent tbody with 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 custom overlay</td>
</tr>
</tbody>
</table>
The desired outcome is for the overlay to only cover the tbody, excluding the thead. Additionally, the overlay should contain specific content (such as a refresh button), so covering every td is not viable.
While my solution functions correctly in Firefox, it encounters issues in webkit browsers. Webkit appears to disregard the position: relative property on the tbody tag, causing the overlay to extend beyond the tbody and cover more than intended.
RESOLVED I was able to resolve this issue by including display: table on the tbody element