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 can use the title
attribute.
For instance, we write
<div title="This is my tooltip"></div>
to set the title
attribute of the div to the tooltip text.
Then when we hover over it, we’ll see the tooltip displayed.
Conclusion
To add a tooltip to a div with HTML, we can use the title
attribute.