AI CSS Animations

Bubble Float Bottom Hover Effect

The button floats up and a speech bubble tail slides out from underneath, turning it into a chat bubble. The tail is a CSS border triangle that starts tucked behind the button's bottom edge.

Also known as: hvr-bubble-float-bottom, speech bubble button hover, tooltip tail hover css.

HTML

<button class="hfx-bubble-float-bottom">Say hello</button>

CSS

.hfx-bubble-float-bottom {
  --c: var(--hfx-color, #3b82f6);
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.7em 1.6em;
  border-radius: 0.5em;
  font: 600 var(--hfx-size, 16px) system-ui, sans-serif;
  cursor: pointer;
  border: 0;
  background: var(--c);
  color: #fff;
  position: relative;
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);}
.hfx-bubble-float-bottom::before {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  border: 0.55em solid transparent;
  border-bottom: 0;
  border-top-color: var(--c);
  transform: translate(-50%, -0.6em);
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.hfx-bubble-float-bottom:is(:hover, :focus-visible) {
  transform: translateY(-0.55em);
}
.hfx-bubble-float-bottom:is(:hover, :focus-visible)::before {
  transform: translate(-50%, -1px);
}

@media (prefers-reduced-motion: reduce) {
  .hfx-bubble-float-bottom, .hfx-bubble-float-bottom *, .hfx-bubble-float-bottom::before, .hfx-bubble-float-bottom::after, .hfx-bubble-float-bottom *::before, .hfx-bubble-float-bottom *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

Customizing this snippet

  • Color: set --hfx-color on the element or a parent. Currently previewing #3b82f6.
  • Base size: set --hfx-size. Every other dimension is in em, so the whole thing scales together. Currently previewing 16px.
  • Speed: change the duration on the transition or animation shorthand. Staggered delays are relative, so they keep their rhythm.
  • Reduced motion: the rule at the end of the CSS turns the motion off for people who asked their OS for less of it. Keep it.

Similar hover effects