Back to library
INTERACTION_095

Horizontal Scroll Cards.

A snap-scrolling row that reveals cards with depth as they pass. Off-screen cards scaled to 0.96 at 70% opacity before the trigger; scaling and fading each card to full as it approaches the centre once horizontal scroll position.

CATEGORY
Cards
COMPLEXITY
Easy
TECH
CSS
PLATFORM
Both
PERFORMANCE
Medium
LIVE PLAYGROUND
CSS / CSS
/* Horizontal Scroll Cards — A snap-scrolling row that reveals cards with depth as they pass. */
.horizontal-scroll-cards {
  --dur: 420ms;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --stagger: 60ms;
  will-change: transform, opacity;
}

.horizontal-scroll-cards > * {
  opacity: 0;
  transform: translateY(14px);
  animation: horizontal-scroll-cards-in var(--dur) var(--ease) forwards;
  animation-delay: calc(var(--i, 0) * var(--stagger));
}

/* off-screen cards scaled to 0.96 at 70% opacity -> scaling and fading each card to full as it approaches the centre */
@keyframes horizontal-scroll-cards-in {
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .horizontal-scroll-cards > * {
    opacity: 1;
    transform: none;
    animation: none;
  }
}
React / TSX
import { useEffect, useRef } from "react";

/** Horizontal Scroll Cards — trigger: horizontal scroll position */
export function HorizontalScrollCards({ children }: { children: React.ReactNode }) {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current;
    if (!el) return;
    if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
      el.dataset["state"] = "in";
      return;
    }
    const io = new IntersectionObserver(
      ([entry]) => {
        if (entry?.isIntersecting) {
          el.dataset["state"] = "in";
          io.unobserve(el);
        }
      },
      { threshold: 0.2 },
    );
    io.observe(el);
    return () => io.disconnect();
  }, []);

  return (
    <div ref={ref} className="horizontal-scroll-cards" data-state="out">
      {children}
    </div>
  );
}

IF YOU LIKE THIS, STEAL THESE TOO.

INTERACTION_096CSS

Glass Reflection Card

A soft reflection sweeps across the glass surface on hover.

Cards / LightView
INTERACTION_098CSS

Image Reveal Card

The image uncovers from behind the card copy on hover.

Cards / LightView
PRO
$49
INTERACTION_100CSS

Floating Feature Card

A key card breathes gently above the grid to signal importance.

Cards / LightView
PRO
$49
INTERACTION_102CSS

Pricing Card Emphasis

The recommended plan lifts, brightens and holds a moving border.

Cards / LightView