How to add a tooltip to a div with HTML?

Spread the love

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.

Leave a Reply

Your email address will not be published. Required fields are marked *