I am faced with the challenge of transforming a hyperlink into an icon while converting the text content into a tooltip using only CSS and without the ability to modify the HTML or add JavaScript. Data is being extracted from an external source in the form of a table, and one of the columns includes hyperlinks that I wish to change into icons with text content displayed as a tooltip upon hovering.
The provided snippet demonstrates my progress so far. Is there a way to enhance the appearance and functionality of the :hover
section to make it mimic a tooltip better? Alternatively, is there another method entirely to achieve the desired outcome?
.external-link {
font-size: 0;
}
.external-link:after {
content: ' ';
background: url(https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196) no-repeat;
display: inline-block;
height: 32px;
width: 32px;
}
.external-link:hover {
/* While it displays the text, the appearance and functionality could be improved.. */
font-size: initial;
}
<a href="https://www.stackoverflow.com/" class="external-link">Stack Overflow</a>