How to add tooltips for button elements with HTML?

Spread the love

Sometimes, we want to add tooltips for button elements with HTML.

In thjis article, we’ll look at how to add tooltips for button elements with HTML.

How to add tooltips for button elements with HTML?

To add tooltips for button elements with HTML, we add the title attribute.

For instance, we write

<button title="Hello World!">Sample Button</button>

to add the title attribute and set the tooltip text ‘Hello World!’ to the button.

Then when we hover over it, ‘Hello World!’ is displayed in the tooltip.

Conclusion

To add tooltips for button elements with HTML, we add the title attribute.

Leave a Reply

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