I'm using W3.CSS and its responsive tables. I would like to add custom tooltips (also from W3), but when I add tooltip into the cell in the first row, then the tooltip is not visible outside the table (see the snippet). Any solution? I have tried z-index: 1 !important; but with no success...
My solution: added padding
to .w3-responsive with size of the tooltip.
.tooltip {
position: relative;
display: inline-block;
border-bottom: 1px dotted black;
}
.tooltip .tooltiptext {
visibility: hidden;
width: 120px;
background-color: #555;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 0;
z-index: 1;
position: absolute;
bottom: 125%;
left: 50%;
margin-left: -60px;
opacity: 0;
transition: opacity 0.3s;
}
.tooltip .tooltiptext::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: #555 transparent transparent transparent;
}
.tooltip:hover .tooltiptext {
visibility: visible;
opacity: 1;
}
<!DOCTYPE html>
<html>
<title>W3.CSS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<body>
<div class="w3-container">
<h3>Table</h3>
<div class="w3-responsive">
<table class="w3-table-all">
<tr>
<th><span class="tooltip">Hover over me <span class="tooltiptext">Some tooltip text</span></span></th>
<th>Last Name</th>
<th>Points</th>
<th>Points</th>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
<td>50</td>
</tr>
</table>
</div>
</div>
</body>
</html>