Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display text under cursor

Whe mouse pointer placed on an element I want to show some text. For example if you place your cursor on upvote of an answer, it shows "This answer is useful". You can see it in below image. I did't even know how to search this.

enter image description here

like image 821
gangadhars Avatar asked May 28 '26 16:05

gangadhars


1 Answers

Add a title attribute to the element. That's what's done in the image above.

<a class="vote-up-off" title="This answer is useful.">up vote</a>

If you want a custom tooltip, see this answer. You would basically use a combination of pseudo elements and custom data-* attributes. You would give the pseudo elements a content value of attr(data-tooltip) in order to access the data-tooltip attribute, for instance.

like image 156
Josh Crozier Avatar answered May 31 '26 05:05

Josh Crozier



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!