CSS Tooltip Generator
Build pure CSS tooltips with a live visual builder — position, arrow, animation, theme colors, and show delay. Copy the CSS + HTML snippets into your site: no JavaScript, no library, works with scripting disabled.
Tooltip Settings
::before + ::afterContrast ratio: 17.74:1
Live Preview
Hover (or tap / Tab-focus) the trigger to see your tooltip. The preview uses the exact CSS from the output below.
Generated Code
0 bytes · 0 rulesHow the generated tooltip works
1 · Text via data attribute
The bubble is the ::before pseudo-element. Its content comes from content: attr(data-tooltip), so you write the text once in HTML and never duplicate it in CSS.
2 · Arrow via borders
The arrow is the ::after pseudo-element: a zero-size box with three transparent borders and one colored border — the classic CSS triangle, automatically tinted to your bubble color.
3 · Revealed on hover
Both pseudo-elements start at opacity: 0; visibility: hidden. The :hover (and optional :focus) rule reveals them with your chosen transition — fade, slide, scale, or bounce.
CSS Tooltip Generator — FAQ
What is a pure CSS tooltip and how does it work?
A pure CSS tooltip is a hover popup built with zero JavaScript. The generator above creates two pseudo-elements on your trigger: ::before renders the bubble by reading your text from the data-tooltip attribute (content: attr(data-tooltip)), and ::after draws the arrow with the classic transparent-border triangle technique. A :hover rule flips opacity and visibility from 0 to 1, with an optional transition for the animation. Because there is no script involved, the tooltip works even when JavaScript is disabled or blocked.
How do I add the generated tooltip to my website?
Three steps: (1) paste the generated CSS into your stylesheet (or a <style> block in your page head); (2) add class="ntt ntt--top" to any element you want to trigger the tooltip — swap ntt--top for ntt--bottom, ntt--left, or ntt--right to change the position; (3) add the data-tooltip="Your text here" attribute with the tooltip content. That is the entire integration — the ::before pseudo-element pulls the text from the attribute automatically, so you never duplicate content.
Can I use different tooltip positions on the same page?
Yes. The generated CSS always emits all four position modifiers — .ntt--top, .ntt--bottom, .ntt--left, and .ntt--right — from a single build, so you can mix positions freely: <button class="ntt ntt--left" data-tooltip="Left one"> and <span class="ntt ntt--bottom" data-tooltip="Bottom one"> on the same page work with one stylesheet. Each modifier positions both the bubble (::before) and the arrow (::after) so they stay aligned on the correct side of the trigger.
How far does the tooltip sit from the trigger element?
With the default settings the bubble sits 14px from the trigger: the 8px gap you set plus the 6px arrow size (the arrow bridges the gap, sitting 8px out). Change the "Gap" slider or the "Arrow size" control and the generator recomputes the calc(100% + Npx) offsets for both ::before and ::after, so bubble and arrow always stay flush no matter what values you pick.
Why is my tooltip cut off or clipped on my page?
The most common cause is an ancestor element with overflow: hidden (or overflow: auto/scroll) — absolutely positioned pseudo-elements are clipped by any ancestor that creates a clipping context, no matter how high your z-index is. Fixes: allow the ancestor to use overflow: visible, move the trigger outside the clipping container, or pick a position (top vs bottom) that points into open space. A second cause is the tooltip hitting the viewport edge; keep max-width reasonable (the default 250px) and prefer left/right positions for triggers near the top or bottom of the screen.
Do CSS tooltips work on mobile and without JavaScript?
Yes — there is no JavaScript to fail in the first place, so ad blockers and disabled scripting change nothing. On touch devices the first tap acts as :hover, revealing the tooltip. This generator also emits :focus and :focus-visible show rules (toggleable), so keyboard users get the tooltip too, and it wraps the animation in a prefers-reduced-motion media query (also toggleable) that disables motion for users who request it.
What contrast ratio does the default dark theme achieve?
The default dark theme uses background #111827 with #ffffff text, which computes to a 17.74:1 contrast ratio — far above the WCAG AA requirement of 4.5:1 for normal text. The live contrast badge under the theme picker recomputes the WCAG ratio for any custom colors you choose and warns you if it drops below 4.5:1, so your tooltips stay readable by design.
Related CSS tooltip searches
This free css tooltip generator creates a pure css tooltip — a css only tooltip with no library and no script. Whether you searched for a tooltip generator css, a data-tooltip css snippet, a custom tooltip css with your brand colors, a hover tooltip css with animation, or a css tooltip example you can copy-paste: set the css tooltip position (top, bottom, left, right), tune the tooltip arrow css and css tooltip animation, and the tool emits clean, dependency-free code. It is a true tooltip without javascript, supports multiline css tooltip text via max-width wrapping, and includes an accessible css tooltip mode with keyboard focus support and prefers-reduced-motion handling.
Free tool by NRTechStudio