AI CSS Animations

Springy Squish Button

Grows slightly on hover and squishes down on press, with an overshooting easing curve so it feels springy rather than mechanical. Great for playful products and games.

Also known as: bouncy button, spring scale hover.

HTML

<button class="hfx-squish">Play</button>

CSS

.hfx-squish {
  --c: var(--hfx-color, #3b82f6);
  font-size: var(--hfx-size, 16px);
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.7em 1.6em;
  border-radius: 0.5em;
  font: 600 1em system-ui, sans-serif;
  cursor: pointer;
  border: 0;
  background: var(--c);
  color: #fff;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);}
.hfx-squish:hover  { transform: scale(1.08); }
.hfx-squish:active { transform: scale(0.92); }

@media (prefers-reduced-motion: reduce) {
  .hfx-squish, .hfx-squish *, .hfx-squish::before, .hfx-squish::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