I have a division
with the overflow
property set to scroll
to view all fields without using too much page space. Each field includes a title span and an associated input. Users can hover over the spans to see helpful tooltips. I use the spans' after
and before
pseudo-elements to create customized tooltips on hover. However, the display of tooltips is limited by the parent div's overflow property.
Below is the rendered HTML example:
<div id="ContentPlaceHolder1_leftDiv" class="l-custom-left">
<div class="personalizedFields">
<table>
<tr>
<td>
<span title="Field Associated: First Name" class="tooltip">First Name</span>
</td>
</tr>
<tr>
<td>
<input name="ctl00$ContentPlaceHolder1$ucPF$ucCustomField36$field36" type="text" id="field36" />
</td>
</tr>
<tr>
<td>
<span title="Field Associated: Last Name" class="tooltip">Last Name</span>
</td>
</tr>
<tr>
<td>
<input name="ctl00$ContentPlaceHolder1$ucPF$ucCustomField37$field37" type="text" id="field37" />
</td>
</tr>
</table>
</div>
</div>
Css for the parent div and spans:
.l-custom-left
{
overflow-x: hidden;
width: 250px;
height: 50vh;
}
.tooltip:hover:after{
background: #333;
background: rgba(0,0,0,.8);
border-radius: 5px;
bottom: 26px;
color: #fff;
content: attr(title);
left: 20%;
padding: 5px 10px;
position: absolute;
z-index: 98;
}
.tooltip:hover:before{
border: solid;
border-color: #333 transparent;
border-width: 6px 6px 0 6px;
bottom: 20px;
content: "";
left: 50%;
position: absolute;
z-index: 99;
}
How can I make the spans' after and before content "override" the parent div's overflow restriction?