All effectsClick & switch

Coverflow Perspective Deck

封面流透视卡组

The selected cover faces forward as neighboring covers recede and turn inward in perspective.

Click a side cover or change the selected cover with arrows

Where to use it

Keep adjacent choices visible in a small album, product, or gallery view. Use a small collection so side covers remain recognizable and invite browsing around the current selection.

Practical example

A record shop’s staff-picks shelf shows one sleeve head-on and its neighbors tilted to each side. Clicking a neighboring sleeve brings it to the front and reveals the next adjacent records.

AI prompt

Add a coverflow deck to [gallery]. Derive each cover geometry from its offset from the selected index, apply local perspective and clear stacking, and preserve keyboard access and reduced-motion behavior.

Example code

Save the standalone HTML as a file and open it in your browser. It uses the same code as the preview.

View HTML
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Coverflow Perspective Deck</title>
  <style>
    :root {
      color-scheme: dark;
      --demo-bg: #171629;
      --demo-ink: #f8f5ff;
      --demo-accent: #b9a6ff;
      --demo-muted: #bfbbd3;
      font-family: system-ui, sans-serif;
      color: var(--demo-ink);
      background: var(--demo-bg);
    }

    *, *::before, *::after { box-sizing: border-box; }
    body { margin: 0; min-width: 0; }
    button, input { font: inherit; }

    .demo {
      display: grid;
      place-items: center;
      align-content: center;
      min-height: 100vh;
      padding: 14px;
      overflow: hidden;
      background: radial-gradient(ellipse at 50% 24%, #28233f, var(--demo-bg) 78%);
    }

    .demo-button {
      border: 1px solid #ffffff3d;
      border-radius: 7px;
      background: #ffffff12;
      color: var(--demo-ink);
      padding: 6px 11px;
      font-size: 12px;
      cursor: pointer;
    }

    :focus-visible {
      outline: 2px solid var(--demo-accent);
      outline-offset: 3px;
    }

    .ui { width: min(100%, 238px); display: grid; gap: 8px; position: relative; font-size: 12px; line-height: 1.35; }
    .ui .surface { min-width: 0; border: 1px solid #676591; border-radius: 10px; background: #282744; padding: 8px; }
    .ui .bar { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
    .ui .actions { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 5px; }
    .ui .muted { color: #cecae9; font-size: 11px; }
    .ui .center { text-align: center; }
    .ui .mono { font: 11px ui-monospace, monospace; font-variant-numeric: tabular-nums; }
    .ui p { margin: 0; }
    .ui .button { min-height: 30px; padding: 4px 7px; border-radius: 7px; border: 1px solid #79779f; background: #3d3a60; color: #f9f5ff; font-size: 11px; font-weight: 650; cursor: pointer; }
    .ui .button:hover { background: #4e4976; }
    .ui .primary { background: #c5eeec; border-color: #dafaee; color: #17213b; }
    .ui .primary:hover { background: #e3fff9; }
    .ui .button:disabled { opacity: .6; cursor: default; }
    .ui .field { min-width: 0; width: 100%; border: 1px solid #79779f; border-radius: 6px; background: #1b1a31; color: #faf5ff; padding: 5px 7px; font-size: 12px; }
    .ui .field::placeholder { color: #c2bcdd; }
    .ui input[type="range"] { accent-color: #b8ebe0; width: 100%; min-width: 0; margin: 0; }
    .ui button { font: inherit; }
    .ui [hidden] { display: none !important; }
    .ui progress { accent-color: #b8ebe0; }
    @media (prefers-reduced-motion: reduce) {
      .ui *, .ui *::after, .ui *::before { transition-duration: 0s !important; animation-duration: 0s !important; scroll-behavior: auto !important; }
    }
    .covers{height:104px;perspective:360px;position:relative}.cover{position:absolute;top:6px;left:50%;width:82px;height:88px;margin-left:-41px;border:1px solid #b6afd4;border-radius:8px;color:white;text-shadow:0 1px 2px #151728;background:linear-gradient(145deg,#484c87,#182b61);display:grid;align-items:end;padding:6px;cursor:pointer;transform:translateX(calc(var(--offset,0) * 57px)) translateZ(calc(var(--depth,0) * -32px)) rotateY(calc(var(--offset,0) * -26deg));z-index:var(--z,3);transition:transform .29s ease,filter .22s ease;filter:brightness(var(--light,1))}.cover-0{background:radial-gradient(circle at 68% 25%,#c9eda5 0 9%,transparent 10%),linear-gradient(148deg,#3c5d9c,#004b54)}.cover-1{background:radial-gradient(circle at 40% 34%,#f6cb99 0 12%,transparent 13%),linear-gradient(155deg,#6f427d,#41253e)}.cover-2{background:repeating-linear-gradient(135deg,transparent 0 15px,#bbec995e 15px 17px),linear-gradient(145deg,#35694b,#183b3c)}.cover span{font-size:11px;text-align:left}
  </style>
</head>
<body>
  <main class="demo">
    <div class="ui"><div class="covers"><button class="cover cover-0" type="button" aria-current="false"><span>Coast</span></button><button class="cover cover-1" type="button" aria-current="true"><span>Dusk</span></button><button class="cover cover-2" type="button" aria-current="false"><span>Canopy</span></button></div><div class="bar"><button class="button prev" type="button" aria-label="Previous cover">←</button><span class="mono" role="status">2 / 3</span><button class="button next" type="button" aria-label="Next cover">→</button></div></div>
  </main>
  <script>
    const covers = [...document.querySelectorAll('.cover')];
    const previous = document.querySelector('.prev');
    const next = document.querySelector('.next');
    let current = 1;
    function select(index) {
      current = Math.max(0, Math.min(index, covers.length - 1));
      for (const [i, cover] of covers.entries()) {
        const offset = i - current, depth = Math.abs(offset);
        for (const [key, value] of Object.entries({ offset, depth, z: 3 - depth, light: depth ? .75 : 1 })) cover.style.setProperty('--' + key, value);
        cover.setAttribute('aria-current', String(i === current));
      }
      document.querySelector('[role=status]').textContent = current + 1 + ' / ' + covers.length;
    }
    for (const [index, cover] of covers.entries()) cover.addEventListener('click', () => select(index));
    previous.addEventListener('click', () => select(current - 1));
    next.addEventListener('click', () => select(current + 1));
    select(current);
  </script>
</body>
</html>

Original example by UI Skills

Further examples