What is the CSS Tooltip Generator?
Generate pure CSS tooltips with configurable position, arrow, and animation. No JavaScript, no dependencies.
Everything runs locally in your browser. Adjust the controls above, preview instantly, and copy clean, production-ready CSS — no account, no upload.
Using the CSS Tooltip Generator
Everything lives in the panel at the top of this page. There is nothing to install — it all runs right here in your browser.
Choose tooltip position
Select top, bottom, left, or right. The generator calculates the correct absolute positioning and arrow direction for each.
Set delay and animation
Add a short transition-delay (100-200ms) to prevent tooltips from flashing during mouse movement.
Copy the CSS
Click Copy and add data-tooltip="your text" to any HTML element to activate the tooltip.
What the generated code looks like
Clean, production-ready CSS — no vendor bloat, no unnecessary declarations.
[data-tooltip] {
position: relative;
}
[data-tooltip]::before {
content: attr(data-tooltip);
position: absolute;
bottom: calc(100% + 8px);
left: 50%;
transform: translateX(-50%);
background: #1d1d1f;
color: #fff;
font-size: 0.75rem;
white-space: nowrap;
padding: 5px 10px;
border-radius: 6px;
pointer-events: none;
opacity: 0;
transition: opacity 0.15s;
}
[data-tooltip]:hover::before {
opacity: 1;
}The data-tooltip attribute approach means you add tooltip text directly in HTML without extra markup. content: attr(data-tooltip) reads the attribute value.
Common mistakes & how to fix them
A few habits trip people up. Here is what to watch for — and the exact fix.
Tooltip hidden by overflow:hidden parent
If any ancestor has overflow: hidden, the absolutely positioned tooltip clips at that boundary.
Fix: Set overflow: visible on ancestors in the tooltip chain, or use a JavaScript tooltip library that appends to document.body.
Tooltip text unreadable on mobile
CSS :hover does not fire reliably on touch screens. Tooltips are invisible to touch users.
Fix: Use CSS tooltips for supplementary information only. For required information, display it inline or use a click-activated popover.
Pro tips for better results
Use pointer-events: none on the tooltip
Without pointer-events: none, the tooltip itself can trigger mouse events, creating a hover flicker loop. Always add this to tooltip pseudo-elements.
Clip long tooltip text with max-width
Long attribute values will create very wide tooltips. Add max-width: 200px and white-space: normal to wrap long tooltip text.
Frequently asked questions
From the blog
Read more →Modern CSS techniques every developer should know
A practical tour of the CSS features that replaced yesterday’s hacks.
From design to code without the friction
How visual generators speed up the build without sacrificing clean output.
Writing CSS that scales with your project
Tokens, naming, and structure that keep large stylesheets maintainable.