Guide
Design a noninteractive tooltip around a real button trigger. Choose eight positions, control wrapping and arrows, and test hover, keyboard focus and reduced-motion behavior. CSS-only output handles hover and focus; the optional enhanced example also adds Escape dismissal and click/tap toggling. The editor processes text and settings locally without a processing upload.
1Choose a tooltip position
Select Top, Bottom, Left, Right or a corner-aligned position. Top Left and Bottom Left align left edges; Top Right and Bottom Right align right edges. The arrow always points toward the trigger.
2Customize the surface and text
Enter 1–240 characters, choose a readable palette and adjust font size, weight, alignment, padding, radius and maximum width. Enable an arrow, custom arrow color or border as needed.
3Test the interaction
Hover over the trigger or use Focus trigger to inspect keyboard focus. Move onto the tooltip to test persistence. Enhanced mode also supports Escape and click/tap. Pinning keeps the preview visible for editing and is excluded from copied output.
4Copy the matching example
Copy CSS, HTML or a complete standalone document. Enhanced mode needs its JavaScript as well as HTML/CSS; Complete Example includes all three. HTML and complete copies receive a fresh ID with a matching aria-describedby relationship.
A tooltip supplies short informational text associated with a trigger. It supplements an accessible control label rather than replacing it. This generator uses a native button, a role=tooltip description and ordinary text. It does not generate interactive menus, links or form controls inside the tooltip. Longer explanations that need interaction belong in a popover or another visible content pattern.
A relative inline wrapper supplies the positioning context for an absolute tooltip element. Hover and focus-within selectors reveal its inner surface with opacity and transform. The generated CSS includes the trigger, focus indicator, positioned container, optional arrow and sample scene. The preview uses the same validated generator, with an extra preview-only pinning rule that is excluded from exports.
Top and Bottom center horizontally over the trigger; Left and Right center vertically beside it. Top Left and Bottom Left align the tooltip's left edge with the trigger's left edge, while Top Right and Bottom Right align right edges. These labels describe alignment, not a diagonal arrow direction. Above-trigger arrows point downward, below-trigger arrows point upward, and side arrows point inward toward the button.
An empty ::after pseudo-element uses colored and transparent borders to form the pointer. Its location follows the selected tooltip side, and arrow size ranges from 3–16px. Matching color follows the main background, including the glass fill, or you can choose an independent opaque HEX color. The distance control measures from the trigger to the arrow tip; disabling the arrow measures directly to the tooltip face.
The surface remains visible while the wrapper or its tooltip is hovered. Transparent padding spans the space between the button and tooltip so the pointer can cross that gap without closing the surface. Pointer events are enabled only while shown, for hover persistence; there are no focusable controls inside. Enhanced mode can dismiss the surface with Escape without requiring the pointer or keyboard focus to move.
The trigger references a unique tooltip ID through aria-describedby, and the description remains in the DOM. Visual hiding uses opacity rather than display:none, visibility:hidden or aria-hidden on the description. Keyboard focus reveals the same text with a visible trigger outline. In enhanced mode Escape dismisses it, and leaving the hover/focus interaction resets the dismissal. Test the final combination with the screen readers and browsers your users rely on.
Fade, Scale, Slide Up, Slide Down and No Animation are available. Duration ranges from 0–600ms with standard timing functions. Placement belongs to the outer element, while opacity, scaling and slide translation belong to the inner surface. This separation prevents a scale or slide effect from replacing translateX(-50%) or translateY(-50%) used for centering. Reduced-motion preferences remove transitions and movement.
Text wraps with a configurable maximum width and a viewport cap. Padding, border and font-size validation reserve a readable text area. The preview scene reserves space for the chosen side and estimated text height, with native scrolling for large examples. The CSS uses fixed placement rather than automatic collision detection: near a viewport edge, choose another position or integrate a collision-aware positioning system in your own application.
A tooltip is a description associated with another control and should contain noninteractive informational content. A popover may contain controls or actions and needs its own focus and dismissal design. The optional click/tap enhancement here only opens or closes descriptive text; it does not turn the surface into an interactive popover. Keep important instructions visible elsewhere when discovery through hover or focus alone would be insufficient.
Dark, Indigo, Blue, Green, Rose and Light palettes provide readable starting points. The text contrast guide uses the chosen fill, or a 90 percent glass fill composited over the selected preview background. Different backdrops can change glass contrast. You can add a border and a bounded box shadow, including spread and opacity. Alpha HEX values are not accepted; the glass preset creates its controlled transparency from a validated opaque base color.
CSS-only output reveals the surface through hover and keyboard focus, but has no Escape handler and may be hard to discover on touch devices. Enhanced output adds an event-listener script for Escape dismissal, click/tap toggling and outside-click dismissal without inline JavaScript handlers. It supports multiple wrappers, avoids duplicate bindings and leaves the trigger focused on Escape. Copy the JavaScript separately or use Complete Example. Your deployment must permit that script or move it to an allowed external file.
Avoid using a tooltip as the only accessible name, hiding its description from the accessibility tree, placing links inside it, or relying on hover for touch users. Do not let animation replace the positioning transform. Keep each aria-describedby value matched to a unique description ID when embedding several examples. Escaped HTML exports treat your text as text, and strict color, numeric, ID and enum validation prevent arbitrary CSS or HTML injection.
- Adding a supplemental description to a form control
- Preparing an informational tooltip for an icon button
- Comparing arrow and animation styles for a dashboard
- Testing wrapping, focus and reduced motion before integration
- Preview eight clearly defined positions and matching CSS border arrows.
- Preserve centering while combining hover/focus with five animation choices.
- Compare CSS-only output and an optional Escape/click/tap enhancement.
- Copy matching scoped CSS, escaped text and unique-ID markup.
What is a CSS tooltip?
It is a short noninteractive description associated with a trigger. This tool reveals a described surface on hover or keyboard focus and exports the matching HTML/CSS.
How do I create a tooltip using CSS?
Use a relative wrapper, a button trigger and an absolutely positioned description. Hover and focus-within selectors reveal the surface. Copy Complete Example for a standalone version of your selected mode.
How do I position a tooltip above an element?
Choose Top to center it above the trigger, or Top Left/Top Right to align the corresponding edges. Its downward arrow points back toward the trigger.
How do I add an arrow to a tooltip?
Enable the arrow and choose its size. The generator uses a border triangle in ::after, with its direction and placement derived from the selected position.
Can I customize tooltip colors?
Yes. Use the pickers, opaque three- or six-digit HEX fields, or six palettes. Arrow, border and shadow colors are editable when their options are enabled.
How do I animate a tooltip?
Choose Fade, Scale, Slide Up or Slide Down, set 0–600ms and select a timing function. Position and animation transforms stay on separate elements. Reduced-motion preferences disable movement and transitions.
Can CSS tooltips work without JavaScript?
Yes for hover and keyboard-focus presentation. CSS-only output does not provide Escape dismissal or reliable tap behavior. Enhanced mode supplies the optional script for those interactions.
Are CSS tooltips accessible?
Accessibility depends on the whole interface. The examples provide a named button, unique aria-describedby relationship, a role=tooltip text description and visible focus. Enhanced mode adds dismissal and tap handling. Keep important information discoverable and test your final implementation with assistive technology.
What is the difference between a tooltip and a popover?
A tooltip describes a trigger with noninteractive text. A popover can contain interactive content and needs additional focus and interaction behavior, which this generator does not implement.
Is the CSS Tooltip Generator free?
Yes. All eight positions, ten editable presets, color and animation controls, previews and export options are free without signup.