Open In App

Building Tooltip using CSS

A Tooltip is used to provide interactive textual hints that gives the user an idea about the element when mouse pointer moves over. For Example, in the below image GeeksForGeeks is a button and when user hovers over it, the additional information “A computer Science Portal” pops-up.



Positions of Tooltip: Depending on the values set to top, bottom, left and right, Tooltip can be positioned at any degree. There are mainly four position which are widely used while building Tooltips for better representation and for good user experience:

Tooltip Arrows


In the above four examples the tooltip generated does not point using arrow, so to make the tooltip look like an speech bubble, add “empty” content after tooltip, with the pseudo element class ::after together with the content property. Like earlier, here also depending on the values of top, bottom, left and right the arrow can be created such that it appears on specific side of the tooltip.
Article Tags :