AI CSS Animations

Grow Hover Effect

The Hover.css classic: the button scales up by a tenth when the pointer arrives and eases back when it leaves. One transform on the element, so it works on any button, card or image.

Also known as: hvr-grow, scale on hover css, hover.css grow.

HTML

<button class="hfx-grow">Get started</button>

CSS

.hfx-grow {
  --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;
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);}
.hfx-grow:is(:hover, :focus-visible) {
  transform: scale(1.1);
}

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

Tailwind CSS version

The same effect using Tailwind utility classes. No custom CSS or config needed.

<button class="rounded-lg bg-blue-500 px-6 py-3 font-semibold text-white transition-transform duration-300 ease-out hover:scale-110 focus-visible:scale-110">
  Get started
</button>

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