AI CSS Animations

Sticker Nav Hover Effect

Hovered menu items slap on like stickers: they tilt, grow and fill with color over a hard offset shadow, leaning left and right in turn. A springy transform does the slap.

Also known as: tilted nav hover, playful menu hover, sticker label hover css.

HTML

<nav class="hfx-nav-sticker">
  <a href="#">Home</a>
  <a href="#">Shop</a>
  <a href="#">Zine</a>
  <a href="#">Contact</a>
</nav>

CSS

.hfx-nav-sticker {
  --c: var(--hfx-color, #3b82f6);
  display: flex;
  align-items: center;
  font: 600 var(--hfx-size, 16px)/1.2 system-ui, sans-serif;
  gap: 0.4em;}
.hfx-nav-sticker a {
  padding: 0.55em 0.95em;
  border-radius: 0.5em;
  color: inherit;
  text-decoration: none;
  transition: transform 0.35s cubic-bezier(0.34, 1.8, 0.64, 1), box-shadow 0.35s cubic-bezier(0.34, 1.8, 0.64, 1), background-color 0.2s ease, color 0.2s ease;
}
.hfx-nav-sticker a:is(:hover, :focus-visible) {
  background: var(--c);
  color: #fff;
  box-shadow: 0.2em 0.25em 0 color-mix(in srgb, var(--c) 45%, #111827);
  transform: rotate(-6deg) scale(1.12);
}
.hfx-nav-sticker a:nth-child(even):is(:hover, :focus-visible) { transform: rotate(5deg) scale(1.12); }

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

<nav class="flex gap-1.5 font-semibold">
  <a href="#" class="rounded-lg px-4 py-2 transition duration-300 hover:-rotate-6 hover:scale-110 hover:bg-blue-500 hover:text-white hover:shadow-[3px_4px_0_#1e3a8a]">Home</a>
  <a href="#" class="rounded-lg px-4 py-2 transition duration-300 hover:rotate-6 hover:scale-110 hover:bg-blue-500 hover:text-white hover:shadow-[3px_4px_0_#1e3a8a]">Shop</a>
  <a href="#" class="rounded-lg px-4 py-2 transition duration-300 hover:-rotate-6 hover:scale-110 hover:bg-blue-500 hover:text-white hover:shadow-[3px_4px_0_#1e3a8a]">Zine</a>
  <a href="#" class="rounded-lg px-4 py-2 transition duration-300 hover:rotate-6 hover:scale-110 hover:bg-blue-500 hover:text-white hover:shadow-[3px_4px_0_#1e3a8a]">Contact</a>
</nav>

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

Sliding Pill Nav Hover Effect
Directional Underline Nav Hover Effect
Dot Indicator Nav Hover Effect
Vertical Nav Indicator Hover Effect