← Back to gallery
CSS

Animated Tooltips

Three opinionated tooltip animations — a frosted-glass command-palette tip with a purple-pink-blue gradient halo + ⌘K keycap (spring scale-in), a rich profile-preview card that unfurls on @-mention hover with a pulsing online dot and italic stats (-1.8° rotate-in), and an editorial marginalia footnote that draws a dotted connector down to a tilted parchment aside with an asterism ornament. Each one uses :hover + :focus-within so keyboard users get the same affordance.

tooltippopoverspringfrosted-glassmarginaliafocus-withinprefers-reduced-motion

Three whispers · hover/focus tooltip atelier

Animated Tooltips

Three opinionated tooltip studies — Aurora Glass (a frosted-glass command-palette tip with a purple-pink-blue gradient halo and an embedded keycap, spring scale-in), Profile Preview (a rich social-mention card that unfurls on hover with avatar, pulsing dot, italic stats, and a -1.8° rotate-in landing), and Editorial Marginalia (a pencilled footnote that draws a dotted connector down to a tilted parchment aside with an asterism ornament). Each tooltip uses :hover + :focus-within so keyboard users get the same affordance.

Crystalline · gradient halo + keycap

Aurora Glass

A dark frosted-glass tooltip framed by a soft purple-pink-blue gradient halo. Pops up with a tiny spring bounce and an embedded ⌘K keycap chip — the kind of tooltip that lives in modern command palettes and design tools.

  • backdrop-filter blur
  • gradient halo border
  • spring scale-in
  • embedded keycap

Convivial · rich mention card

Profile Preview

A mini profile that unfurls when you hover an @-mention in running text. Avatar with a pulsing online dot, italic stats grid, layered drop shadow, and a slight -1.8° rotation as the card lands — the unhurried social-interface gesture.

  • avatar pulsing dot
  • -1.8° rotate-in
  • italic stat grid
  • layered drop-shadow

Marginalia · footnote in the margin

Editorial Marginalia

A footnote pencilled in the margin of an old book. The dotted connector draws downward, parchment paper unfolds, italic serif body lands at a slight tilt. An asterism (✻) sits at the corner like a librarian's mark.

  • dotted connector draws
  • parchment gradient
  • -0.8° hand tilt
  • asterism ornament

Tooltip inspector

Aurora Glass

hover trigger
Search anywhere⌘ K
  • backdrop-filter blur
  • gradient halo border
  • spring scale-in
  • embedded keycap

A dark frosted-glass tooltip framed by a soft purple-pink-blue gradient halo. Pops up with a tiny spring bounce and an embedded ⌘K keycap chip — the kind of tooltip that lives in modern command palettes and design tools.

Helped you ship something? 🐟 Send my cat a churu

/* Frosted-glass tooltip with a gradient halo border and an embedded keycap; spring scale-in on :hover. */
.t-wrap { position: relative; display: inline-block; }

.t-tip {
  position: absolute;
  bottom: calc(100% + 16px);
  left: 50%;
  /* Spring overshoot via cubic-bezier with Y > 1 */
  transform: translateX(-50%) translateY(10px) scale(0.92);
  opacity: 0;
  pointer-events: none;
  transition: all 0.36s cubic-bezier(0.34, 1.56, 0.64, 1);
  /* Gradient halo border via padding + nested inner */
  background: linear-gradient(135deg,
    rgba(167, 139, 250, 0.9) 0%,
    rgba(244, 114, 182, 0.75) 50%,
    rgba(96, 165, 250, 0.9) 100%);
  padding: 1.5px;
  border-radius: 11px;
  filter: drop-shadow(0 18px 36px rgba(80, 40, 120, 0.4));
}

.t-tip-inner {
  background: rgba(15, 14, 22, 0.96);
  backdrop-filter: blur(18px);
  border-radius: 9.5px;
  padding: 11px 14px;
  color: rgba(255, 255, 255, 0.96);
}

.t-wrap:hover .t-tip,
.t-wrap:focus-within .t-tip {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

How to make this

An accessible animated tooltip keeps the trigger focusable, connects it with aria-describedby, reveals the tooltip on hover and focus-within, and animates opacity plus transform instead of layout position.

html
1<span class="tooltip-study">2  <button id="export-trigger" type="button" aria-describedby="export-tip">    Export  </button>5  <span id="export-tip" class="tooltip-study__tip" role="tooltip">    Saves a transparent PNG  </span></span> <style>.tooltip-study {  position: relative;  display: inline-grid;  place-items: center;}.tooltip-study button {  border: 0;  border-radius: 999px;  padding: .65rem 1rem;  color: #f8fafc;  background: #1e293b;  font: 700 .9rem/1 ui-sans-serif, system-ui;}.tooltip-study__tip {25  position: absolute;  inset-inline-start: 50%;  inset-block-end: calc(100% + .7rem);  max-inline-size: 15rem;  padding: .5rem .65rem;  border-radius: 8px;  color: #0f172a;  background: #bae6fd;  box-shadow: 0 14px 30px rgba(15, 23, 42, .2);  opacity: 0;  pointer-events: none;  transform: translate(-50%, .45rem) scale(.96);  transform-origin: 50% 100%;38  transition:    opacity .18s ease,    transform .22s cubic-bezier(.2,.8,.2,1);}42.tooltip-study:hover .tooltip-study__tip,.tooltip-study:focus-within .tooltip-study__tip {  opacity: 1;  transform: translate(-50%, 0) scale(1);}47@media (prefers-reduced-motion: reduce) {  .tooltip-study__tip { transition: none; transform: translate(-50%, 0); }}</style>

Annotated snippet

  1. Line 1The wrapper is the positioning context and hover/focus scope. Keep the trigger and tooltip as siblings so :focus-within can reveal the tip for keyboard users.
    PitfallIs hover enough for accessibility?

    No. Reveal the tooltip on keyboard focus as well, usually with :focus-within on the trigger wrapper, and connect the trigger to the tooltip with aria-describedby.

  2. Line 2aria-describedby connects the trigger to the tooltip text. The button remains the interactive element; the tooltip only describes it.
    PitfallShould a tooltip contain buttons or links?

    No. A tooltip is descriptive, not interactive. If the surface contains actions, use a popover, menu, dialog, or disclosure pattern instead.

  3. Line 5role="tooltip" belongs on the descriptive bubble. It should appear near the trigger and should not contain focusable controls.
    PitfallShould a tooltip contain buttons or links?

    No. A tooltip is descriptive, not interactive. If the surface contains actions, use a popover, menu, dialog, or disclosure pattern instead.

  4. Line 25Absolute positioning places the bubble without changing surrounding layout. The inline start plus translate pair centers it over the trigger.

    Watch the "Save as draft" line below the trigger. When the tooltip appears, an in-flow bubble shoves the surrounding layout; an absolute bubble lifts out of flow so neighbours stay put.

    PitfallWhy animate transform instead of top or bottom?

    Top, bottom, and margin change layout-position values. Transform moves the painted tooltip from a stable anchor and is easier to compose with opacity.

  5. Line 38Animate transform and opacity, not top, bottom, or margin. The tooltip can move visually without forcing layout.

    Both bubbles bob up the same 12px. The margin keyframe shifts the bubble inside the flex column, so the button and "Save as draft" below jolt with it; transform paints the same motion without touching the layout.

    PitfallWhy animate transform instead of top or bottom?

    Top, bottom, and margin change layout-position values. Transform moves the painted tooltip from a stable anchor and is easier to compose with opacity.

  6. Line 42Use both hover and focus-within. A hover-only tooltip disappears for keyboard users and often fails automated accessibility checks.
    PitfallIs hover enough for accessibility?

    No. Reveal the tooltip on keyboard focus as well, usually with :focus-within on the trigger wrapper, and connect the trigger to the tooltip with aria-describedby.

  7. Line 47Reduced motion keeps the tooltip available but removes the slide and scale. The description still appears instantly.

Other pitfalls

How should tooltips work on touch screens?
Do not hide critical information in hover-only UI. For touch, prefer always-visible helper text, a tap-triggered popover, or an explicit info button that can be dismissed.
Can I use CSS Anchor Positioning for tooltips?
CSS Anchor Positioning is useful but still needs browser-support planning. Keep an absolute-position fallback, and test collision handling near viewport edges.

Notes

Overview

Three tooltip studies showing different production registers: a frosted-glass command-palette tip with a gradient halo and embedded keycap (spring scale-in), a rich profile-preview card that unfurls on @-mention hover with avatar + stats (rotate-in landing), and an editorial marginalia footnote that draws a dotted connector down to a tilted parchment aside.

When to use it

Reach for tooltips for keyboard-shortcut hints, glossary terms, and inline disclosures of secondary info. Skip them for critical content (use inline text instead) and for any interaction that needs user action inside the tooltip itself — tooltips close on focus loss, which traps modal actions.

How it works

Each tooltip sits absolutely positioned next to its trigger inside a relatively-positioned wrapper. CSS :hover + :focus-within on the wrapper toggle opacity + transform on the tooltip. The frosted study layers a backdrop-filter: blur(12px) + a soft gradient halo behind the tip; the profile card uses perspective(800px) rotateX(8deg) + a slight translateY for the unfurl-in landing; the editorial study draws an SVG dashed connector via stroke-dashoffset animation paired with the body fade-in. For positioning collisions with viewport edges, drive the placement with a JS measure-and-shift pass on mouseenter — pure CSS cannot detect edge overflow.

Production gotchas

Tooltips that close on focus loss are the right pattern for transient hints but the wrong pattern for any tooltip that contains interactive content (links inside the tip). Use aria-haspopup + a popover instead when users need to click inside. Tooltips clipped by overflow: hidden on an ancestor look broken — either move the tooltip to a portal at the body root or use the new popover="auto" attribute which renders in the top layer above all overflow constraints.

Accessibility

Tooltips need role="tooltip" + aria-describedby on the trigger pointing to the tooltip ID so screen-reader users hear the helper text after the control name. Hover-only tooltips are inaccessible to keyboard users; always include :focus-within as a trigger. Under prefers-reduced-motion: reduce drop the unfurl/spring transforms and use a flat opacity fade.

References

Implementation depth

Tooltips are support text, not required content. Use focus and hover to reveal them, keep the trigger label meaningful on its own, and avoid making the animation the only way to discover important information.

Positioning is the fragile part. Long strings, viewport edges, and touch input can all break a pretty tooltip. Test focus-within, Escape behavior where applicable, and reduced motion with the tooltip already visible.