I needed to add a tooltip to the element, but I did not want it to be a tag.
I decided to use the tag instead:
<span class="glyphicons glyphicons-medicine pharmacy-icon" data-toggle="tooltip" data-placement="right" title="Pharmacy Tooltip"></span>
What will be displayed (when hovering over the glyphicon of medicine) message: pharmacy pharmacy
If you want to take it one step further, you can even customize the tooltip as you like, the following code will be how you can change its style:
.tooltip { filter: drop-shadow(rgba(0, 0, 0, 0.3) 0 2px 5px); .tooltip-inner { background-color: white; color: red; } .tooltip-arrow { border-right-color: white; } }
This will change the background color of the tooltip, and the tooltip arrow will be white with red text and the shadow around the tooltip.
If you use bootstrap, be sure to include the following line of code in which the tooltip will be used:
$('.someClass').tooltip();
This ensures that you use the bootstrap tooltip and not the default browser tooltip
source share