Sometimes, we want to add a tooltip to a div with HTML.
In this article, we’ll look at how to add a tooltip to a div with HTML.
How to add a tooltip to a div with HTML?
To add a tooltip to a div with HTML, we set the title
attribute.
For instance, we write
<div title="This is my tooltip" class="visible"></div>
to set the title
attribute to the tooltip text.
Then the tooltip text would show.
Conclusion
To add a tooltip to a div with HTML, we set the title
attribute.