AI CSS Animations

Icon Pop Nav Hover Effect

A text-only menu where hovering an item pops its icon up above the label with a springy bounce. Each icon is an inline SVG parked at scale zero, so the labels never shift.

Also known as: nav icon appears on hover, menu icon bounce, navbar icon reveal.

HTML

<nav class="hfx-nav-icon-pop">
  <a href="#"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 11 12 4l9 7v8.5a1.5 1.5 0 0 1-1.5 1.5H15v-6H9v6H4.5A1.5 1.5 0 0 1 3 19.5z"/></svg>Home</a>
  <a href="#"><svg viewBox="0 0 24 24" aria-hidden="true"><rect x="3" y="7" width="18" height="13" rx="2"/><path d="M8 7V5.5A1.5 1.5 0 0 1 9.5 4h5A1.5 1.5 0 0 1 16 5.5V7M3 13h18"/></svg>Work</a>
  <a href="#"><svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="8" r="4"/><path d="M4 21a8 8 0 0 1 16 0"/></svg>About</a>
  <a href="#"><svg viewBox="0 0 24 24" aria-hidden="true"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="m3 7 9 6 9-6"/></svg>Contact</a>
</nav>

CSS

.hfx-nav-icon-pop {
  --c: var(--hfx-color, #3b82f6);
  display: flex;
  align-items: center;
  font: 600 var(--hfx-size, 16px)/1.2 system-ui, sans-serif;
}
.hfx-nav-icon-pop a {
  position: relative;
  padding: 1.9em 0.9em 0.6em;
  color: inherit;
  text-decoration: none;
  transition: color 0.25s ease;
}
.hfx-nav-icon-pop svg {
  position: absolute;
  left: 50%;
  top: 0.35em;
  width: 1.3em;
  height: 1.3em;
  margin-left: -0.65em;
  fill: none;
  stroke: var(--c);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transform: translateY(0.8em) scale(0.2);
  transition: opacity 0.2s ease, transform 0.45s cubic-bezier(0.34, 1.8, 0.64, 1);
}
.hfx-nav-icon-pop a:is(:hover, :focus-visible) { color: var(--c); }
.hfx-nav-icon-pop a:is(:hover, :focus-visible) svg {
  opacity: 1;
  transform: translateY(0) scale(1);
}

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

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