CSS Tooltip Generator

Design a tooltip, watch it on all four sides at once, check that it is readable and copy the CSS, the HTML and a small Escape-key script.

Runs in your browser. Your files never leave your device. See how to check

…

How to do it

  1. 1
    Choose the type

    Select Accessible or Pure CSS, then the position and a class name for the wrapper.

  2. 2
    Write the text

    Type the trigger label and the tooltip text, keeping the tip to one short sentence.

  3. 3
    Style the bubble

    Set background and text colours, border, font size, maximum width, radius, arrow and gap.

  4. 4
    Set the timing

    Choose the animation, show delay and duration, and look at the four-sided preview.

  5. 5
    Check readability

    Read the contrast, size and delay checks and adjust colours until they pass.

  6. 6
    Copy the code

    Copy the CSS and HTML, and for the accessible version add the Escape key script to your page.

About this tool

A tooltip is the small label that appears when you point at or focus an icon button, explaining what it does. Many tooltip snippets on the web only work with a mouse: keyboard users never see them, screen readers never hear them, and on a phone they cannot be opened at all. This generator gives you two versions. The accessible version uses a real element with role="tooltip", linked to its trigger with aria-describedby, so screen readers announce the help text after the button name; it opens on hover and on keyboard focus, and the included script lets people close it with Escape, as WCAG 1.4.13 asks. The pure CSS version is a single element with a data-tip attribute and the text drawn by a ::after pseudo-element, handy for decorative hints in prototypes; it also copies the text into aria-label so it is not completely silent. For either version you choose the side (top, right, bottom or left), background and text colours, an optional border, font size, maximum width, corner radius, arrow size, the distance from the trigger and a shadow. Timing controls set the show delay and the animation length, and the animation can be a simple fade, a fade with a small grow, or a fade with a short slide toward the trigger. A reduced-motion rule drops the movement for people who ask for less animation.

Preview on all four sides

The preview renders your design on top, right, bottom and left at the same time, so you can see how the arrow follows the bubble and spot a tooltip that would be cut off on one side. The side you selected has the text in brackets. Hover with a mouse or press Tab to move focus through the buttons; on a touch screen, tapping a button focuses it and shows its tooltip.

Readability checks

The checks measure the contrast between the text and the bubble colour against the WCAG AA level of 4.5 to 1, warn when the font is smaller than 12 pixels, and flag a show delay longer than half a second, which makes tooltips feel broken. In pure CSS mode a reminder explains that important help text belongs in the accessible version.

Presets

Five starting styles are included: dark, light with a border, brand blue, a warning style in amber and a pill shape without an arrow. Each keeps your text, trigger and class name, so switching styles does not lose your work.

Limits

These tooltips are pure CSS, so they cannot flip to the other side when they reach the edge of the window; pick the side with the most room, or use the CSS for the look together with a positioning library. The tool does not make toggletips (help that opens on click and stays open) or rich popovers with links and buttons, which need different markup. Never put essential information only in a tooltip: people on touch screens and some assistive technology may not open it.

Worked example

A Share icon button gets the accessible tooltip Copies the link to your clipboard, white 13px text on #111827 with a 6px arrow on top, an 8px gap and a 150ms fade after a 150ms delay. The contrast is 17.74 to 1, far above the 4.5 needed. Switching to the Warning preset gives #78350f text on #fef3c7, still 8.15 to 1, with the bubble moved below the button.

Quick facts

Frequently asked questions

Which version should I choose?

Use the accessible version for anything people need to understand, such as icon-only buttons. It uses role="tooltip" and aria-describedby so screen readers read it, and it shows on keyboard focus. The pure CSS version is fine for prototypes and purely visual hints.

Do the tooltips work on phones?

Partly. The trigger in the generated HTML is a button, and tapping a button gives it focus, so the tooltip appears. Tapping elsewhere hides it. Phones have no hover, so do not hide anything important inside a tooltip.

Why is there an Escape key script?

WCAG 1.4.13 says content that appears on hover or focus must be dismissible without moving the pointer or focus, so it does not block what is underneath. The short script adds a class on Escape that hides open tooltips, and removes it when the pointer or focus leaves.

Can the tooltip contain links or buttons?

No. A tooltip should only hold short text; people cannot move the pointer or focus into it to click something. For interactive content, use a disclosure button that opens a popover or dialog.

How do I change the delay?

Use the Show delay slider. Around 100 to 300 milliseconds stops tooltips flashing when the pointer passes over a toolbar, while still feeling quick. The delay applies to showing; hiding is immediate.

Can I use several tooltips on one page?

Yes. Use the same class on each wrapper and give every tooltip element a unique id, matched by its button's aria-describedby value. The HTML tab shows the pattern with tip-1.

Guides for this tool

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages