I am trying to have a sticky first column as well as some CSS tooltips. Here is a simplified model of my setup:
div.container
{
width: 300px;
overflow: auto;
}
table
{
border-collapse: collapse;
}
td
{
border: 1px black solid;
}
td div
{
width: 80px;
height: 30px;
}
td:first-child
{
position: sticky;
left: 0;
background-color: lime;
}
[data-tooltip]:hover:after
{
content: attr(data-tooltip);
position: absolute;
background: white;
top: 22px;
}
<!doctype html>
<div class="container">
<table>
<tr>
<td><div data-tooltip="123">hover me</div>
<td><div></div>
<td><div></div>
<td><div></div>
<td><div></div>
<td><div></div>
<td><div></div>
<td><div></div>
<tr>
<td><div></div>
<td><div></div>
<td><div></div>
<td><div></div>
<td><div></div>
<td><div></div>
<td><div></div>
<td><div></div>
</table>
</div>
The problem is that the tooltip hides behind the cell on the next row and I can't find any solution for that (other than removing position: sticky) which is not an acceptable solution in my case.
What should I do to bring the tooltip in front? z-index seems to do nothing in this case.