CSS Tooltip Generator
Create pure-CSS tooltips — pick position, colors, radius, and arrow, hover a live preview, then copy the code. No JavaScript required. Free.
💡 How to use
- Style the tooltip and hover the preview button to see it appear.
- Add
class="tooltip"and adata-tip="…"attribute to any element to give it a tooltip. - It is pure CSS — no JavaScript needed.
Free CSS Tooltip Generator
Create pure-CSS tooltips and copy the code in one click. Choose the position, colors, radius, and arrow, hover a live preview to test it — then paste ready-to-use tooltip CSS. No JavaScript required. Free, no sign-up, runs in your browser.
What is a CSS tooltip?
A tooltip is a small label that appears when a user hovers over or focuses an element, giving extra context — what a button does, what an icon means, or the full text of something truncated. A CSS-only tooltip builds this entirely with pseudo-elements and the :hover state, so it needs no JavaScript, no library, and no extra markup beyond a data attribute holding the text.
How to use the tooltip generator
It is instant:
- Type the tooltip text and choose where it appears (top, bottom, left, or right).
- Set the background, text color, radius, and font size, and toggle the arrow.
- Hover the preview button to see it in action.
- Copy the CSS and add the class and data-tip attribute to your element.
How the CSS-only tooltip works
The technique uses two pseudo-elements on a positioned element. The ::after pseudo-element pulls its text from a data-tip attribute with content: attr(data-tip) and is positioned above, below, or beside the element. The ::before pseudo-element draws the little arrow using the border triangle trick. Both start hidden and fade in on hover. Because the text lives in a data attribute, you can reuse the same class everywhere and just change the attribute value.
Adding a tooltip to your elements
After pasting the CSS, give any element the tooltip class and a data-tip attribute — for example, a span or button with class="tooltip" data-tip="Save changes". The tooltip appears on hover with no other code. Keep the text short so it fits on one line; the generated CSS uses white-space: nowrap, so very long text is better shortened or handled with a different pattern.
Tooltips and accessibility
Hover-only tooltips are convenient but not accessible on their own: touch users cannot hover, and screen-reader users may not perceive them. For important information, back the visual tooltip with a real title attribute or, better, an aria-label or aria-describedby on the element so assistive technology announces it. Never hide essential content behind hover alone — treat CSS tooltips as a visual enhancement for supplementary hints.
Pro tip
Add a short transition so the tooltip fades in smoothly rather than snapping, which this generator includes. Match the arrow color to the tooltip background so it reads as one shape, and keep tooltips clear of screen edges by choosing a sensible position. For richer arrows and shapes, our Triangle Generator pairs well with this tool.
FAQ
Is this CSS Tooltip Generator free?
Do these tooltips need JavaScript?
How do I add a tooltip to an element?
How do I change the tooltip's position?
Are CSS tooltips accessible?
Why is my tooltip text cut off?
Do CSS tooltips work in all browsers?
Related tools
Pro tip: pair this tool with CSS Box-Shadow Generator and CSS Gradient Generator for a faster SEO workflow.