I have a social media icon with a click-through URL. When someone hovers over the icon, I would like a sentence to be displayed over it (a tooltip). Using the "title" command is doing the job, but I can't style it as needed. I believe using an inline span or a span class could be a solution. Despite trying different setups following online articles, I still can't get the tooltip to show up. Can someone guide me on how the html should be structured (div class/span class) and the corresponding SCSS setup?
Below is my code without the tooltip, and I'm seeking assistance in implementing it:
<div class="socials">
<a href="https://twitter.com/user" target="_blank">
<img src="../images/twitter.png" alt="twitter logo" >
</a>
Please note that I am relatively new to coding with only 4 weeks of experience. Therefore, I prefer something simple to grasp and troubleshoot.
I have tried using HTML/CSS setups from various websites mentioned below, but none seem to work for me:
- How to add tooltip to image on hover with CSS
- how to display Tooltip on click of an image link
- https://www.w3schools.com/css/css_tooltip.asp
The tooltip design on this particular site closely matches what I am looking for: 4.
However, most examples do not incorporate a clickable image feature.
I am eagerly awaiting your feedback. Thank you!