I need to add a hover functionality to labels with overflowing text. Checkout this code pen to find an example of what I mean.
HTML & CSS:
.sku {
width: 300px;
}
.tooltipp {
white-space: nowrap;
overflow-x: hidden;
text-overflow: ellipsis;
}
.tooltipp:active,
.tooltipp:hover {
overflow-x: visible;
}
.tooltipp:active span,
.tooltipp:hover span {
position: relative;
background-color: PaleGoldenRod;
border: 1px solid gray;
padding: 3px;
margin-left: -4px;
}
<div class="sku tooltipp"><span>Hover over or touch me to see the full version of this string. It looks like replaced by tooltip.</span></div>
<div class="sku tooltipp"><span>Short</span></div>
As you can see in the example the hover is always enabled even if there is no overflow. Is it possible to activate the hover only when there is actual overflowing content?