/* Generated on cssgen.org */
Design lightweight, zero-dependency tooltips. Configure position, colors, and arrows visually to generate elegant pure CSS popups.
/* Generated on cssgen.org */
In the modern web ecosystem, developers often reach for heavy JavaScript libraries to accomplish simple tasks. However, if you only need to display a short string of text when a user hovers over an icon or button, downloading a 30kb JS library is massive overkill.
By leveraging HTML5 data-* attributes, we can build a highly performant, zero-dependency tooltip. The text is stored directly in the HTML markup (making it accessible to screen readers), and CSS reads that text using the content: attr(data-tooltip); property to display it in a beautifully styled popup.
:hover state, keyboard-only users will miss it unless you also trigger the tooltip on the :focus or :focus-visible pseudo-classes. Our generated code handles this automatically for you.You create a pure CSS tooltip by applying the ::before and ::after pseudo-elements to a parent container. The ::before element acts as the text box, and the ::after element acts as the arrow. By storing the text in a custom HTML attribute like data-tooltip="Hello", you can pull that text into CSS using the content: attr() property.
No. The CSS content property can only render raw strings of text. It cannot parse HTML tags. If you need a tooltip that contains bolded words, images, or clickable links, you must build the tooltip using standard hidden HTML `div` elements and toggle their visibility with JavaScript or CSS sibling selectors.
Because CSS tooltips are rigidly positioned (e.g., exactly 100% above the element), they do not know where the edge of the viewport is. If an element is at the very top of the screen and the tooltip is set to "Top", it will render off-screen. This is the primary limitation of CSS tooltips compared to JS positioning engines.