DEV Community

Cover image for Pure CSS Tooltip
Renzo Zue
Renzo Zue

Posted on • Updated on

Pure CSS Tooltip

ig @r_zue
twitter @re_zue
website zueprojects.dev

I am currently working on the development of a CSS framework [Z.CSS], one of the objectives is to make it as simple, functional and with the least use of js as possible.

It is very common to use tooltips based on js, but in this approach I leave you the code and some examples to use the tooltips based on pure CSS that I implement for my framework.

The content of the tooltip is defined in the element through the attribute

data-tooltip-text="Tooltip Left"

which is referenced in the css as follows

content: attr(data-tooltip-text);

I hope it helps for something ;)

Compatibility

image

MDN

Top comments (0)