{
  "id": "parallax-scrolling",
  "name": "Parallax Scrolling",
  "category": "effects",
  "tags": [
    "parallax",
    "scroll-driven",
    "view timeline",
    "image",
    "depth",
    "hero"
  ],
  "description": "An image that moves slower than the page inside its frame as it scrolls past, using a view() scroll timeline.",
  "url": "https://copy-css.com/snippets/parallax-scrolling",
  "markdown": "https://copy-css.com/snippets/parallax-scrolling.md",
  "html": "<div class=\"parallax-frame\">\n  <img src=\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 40'%3E%3Crect width='60' height='40' fill='%23bae6fd'/%3E%3Ccircle cx='14' cy='11' r='6' fill='%23fde047'/%3E%3Cpath d='M0 40V30l15-6 15 5 15-7 15 6v12z' fill='%2334d399'/%3E%3Cpath d='M36 31l5-15 5 15zM45 32l4-11 4 11zM8 36l4-12 4 12z' fill='%23047857'/%3E%3C/svg%3E\" alt=\"Green hills and pine trees on a sunny day\" width=\"280\" height=\"220\">\n</div>",
  "css": ".parallax-frame {\n  width: 100%;\n  max-width: 280px;\n  height: 160px;\n  margin: 0 auto;\n  overflow: hidden;\n  border-radius: 16px;\n}\n\n.parallax-frame img {\n  display: block;\n  width: 100%;\n  height: 140%;\n  object-fit: cover;\n}\n\n@supports (animation-timeline: view()) {\n  .parallax-frame img {\n    animation: parallax-frame-shift linear both;\n    animation-timeline: view();\n  }\n}\n\n@keyframes parallax-frame-shift {\n  from {\n    transform: translateY(-28%);\n  }\n\n  to {\n    transform: translateY(0);\n  }\n}\n\n@media (prefers-reduced-motion: reduce) {\n  .parallax-frame img {\n    height: 100%;\n    animation: none;\n  }\n}",
  "features": [
    "scroll-driven animations",
    "keyframe animations",
    "transforms",
    "reduced-motion support"
  ],
  "customProperties": []
}
