---
title: "Parallax"
description: "Parallax component - depth layers that move at their own speed as a scene scrolls by, and reveal-on-scroll for any element. Scroll-driven animations: no script, no scroll listener."
slug: "parallax"
---

import { DocPage, PageHeader, SkillPanel, SourceFiles, DocLink, SkillField, SkillText, SkillRow, ApiPill } from "../../lib/components/index";

<DocPage meta={meta}>

<PageHeader slug="parallax" title="Parallax" component="parallax">
  Depth on scroll without a line of script. A <code>.parallax</code> scene is a view timeline - its passage through the scrollport - and every <code>.parallax-layer</code> translates along it by its depth: far layers lag behind, near ones lead, the picture separates into planes. <code>.parallax-reveal</code> fades and lifts any element as it scrolls into view - the transitions between the sections of a <DocLink href="website-landing-page.html">landing page</DocLink>. Reduced motion and older browsers get the still composition.
</PageHeader>

<SkillPanel component="parallax">
  <SkillField label="Native basis">
<SkillText>Scroll-driven animations: <code>view-timeline</code> on the scene drives each layer's <code>translate</code>; <code>animation-timeline: view()</code> drives the reveals. No listener, no IntersectionObserver - the compositor runs it.</SkillText>
  </SkillField>

  <SkillField label="Web Platform APIs">
<SkillRow>
    <ApiPill href="https://developer.mozilla.org/en-US/docs/Web/CSS/view-timeline-name" title="the scene's timeline"><code>view-timeline</code></ApiPill>
    <ApiPill href="https://developer.mozilla.org/en-US/docs/Web/CSS/animation-timeline/view" title="reveal on entry"><code>animation-timeline: view()</code></ApiPill>
    <ApiPill href="https://developer.mozilla.org/en-US/docs/Web/CSS/animation-range" title="cover / entry ranges"><code>animation-range</code></ApiPill>
    <ApiPill href="https://developer.mozilla.org/en-US/docs/Web/CSS/translate" title="the layer shift"><code>translate</code></ApiPill>
    <ApiPill href="https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion" title="the still composition"><code>prefers-reduced-motion</code></ApiPill>
  </SkillRow>
  </SkillField>

  <SkillField label="Classes">
<SkillRow>
    <code>.parallax</code>
    <code>.parallax-layer</code>
    <code>.parallax-content</code>
    <code>.parallax-stage</code>
    <code>.parallax-drift</code>
    <code>.parallax-reveal</code>
  </SkillRow>
  </SkillField>

  <SkillField label="Data attributes">
<SkillText><code>data-depth</code> (<code>far</code>, <code>mid</code>, <code>near</code>, <code>front</code>) and <code>data-motion</code> (<code>zoom</code>, <code>fade</code>, <code>spin</code>, <code>pass</code>, <code>zoom fade</code>) on a layer; <code>data-sticky</code> + <code>.parallax-stage</code> for a pinned scene (<code>--parallax-stage</code>, <code>--parallax-length</code>); <code>data-axis="inline"</code>; <code>.parallax-drift</code> for in-flow elements; <code>data-reveal</code> (<code>zoom</code>, <code>fade</code>) on a reveal; <code>--parallax-speed</code> (a percentage or a length; negative leads), <code>--parallax-scale</code>, <code>--parallax-turn</code>, <code>--parallax-rise</code>.</SkillText>
  </SkillField>
</SkillPanel>

```html example label="Seven planes" hint="Scroll slowly: seven layers, each with its own --parallax-speed (60% for the sky down to -18% for the trees). The title is a layer too, between the moon and the mountains - the ridge travels faster than the title, so it rises from behind the mountains as you scroll. No script: the scene is a view timeline." previewStyle="align-items:stretch;"
<div
  style="
    height: 34rem;
    overflow: auto;
    overscroll-behavior: contain;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
  "
>
  <p style="display: grid; place-items: center; height: 28rem; margin: 0; color: var(--muted-foreground)"
    >Scroll down ↓</p
  >
  <section class="parallax" style="height: 34rem; background: #0b1026" aria-label="A night landscape">
    <div
      class="parallax-layer"
      style="--parallax-speed: 60%; z-index: -7; background: linear-gradient(#0b1026, #2a1b4f 60%, #5b2a63)"
      ><svg viewBox="0 0 400 300" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
        <circle cx="196.2" cy="168.2" r="0.55" fill="#fff" opacity="0.51" />
        <circle cx="177.3" cy="151.9" r="0.50" fill="#fff" opacity="0.92" />
        <circle cx="235.8" cy="123.2" r="0.77" fill="#fff" opacity="0.86" />
        <circle cx="263.0" cy="23.0" r="1.05" fill="#fff" opacity="0.50" />
        <circle cx="268.8" cy="47.4" r="1.13" fill="#fff" opacity="0.67" />
        <circle cx="70.5" cy="15.0" r="1.62" fill="#fff" opacity="0.98" />
        <circle cx="48.3" cy="133.3" r="1.64" fill="#fff" opacity="0.47" />
        <circle cx="167.7" cy="165.1" r="1.27" fill="#fff" opacity="0.53" />
        <circle cx="68.2" cy="295.7" r="0.98" fill="#fff" opacity="0.50" />
        <circle cx="218.8" cy="99.1" r="0.60" fill="#fff" opacity="0.85" />
        <circle cx="140.7" cy="105.0" r="0.50" fill="#fff" opacity="0.95" />
        <circle cx="95.5" cy="265.2" r="1.01" fill="#fff" opacity="0.50" />
        <circle cx="241.2" cy="120.5" r="1.39" fill="#fff" opacity="0.77" />
        <circle cx="54.4" cy="67.2" r="0.99" fill="#fff" opacity="0.41" />
        <circle cx="19.1" cy="123.7" r="1.29" fill="#fff" opacity="0.77" />
        <circle cx="382.1" cy="97.5" r="0.97" fill="#fff" opacity="0.67" />
        <circle cx="175.5" cy="251.5" r="0.99" fill="#fff" opacity="0.64" />
        <circle cx="105.6" cy="71.0" r="1.37" fill="#fff" opacity="0.44" />
        <circle cx="108.1" cy="230.0" r="1.52" fill="#fff" opacity="0.98" />
        <circle cx="370.7" cy="258.1" r="1.37" fill="#fff" opacity="0.77" />
        <circle cx="221.8" cy="7.2" r="0.82" fill="#fff" opacity="0.58" />
        <circle cx="86.1" cy="118.1" r="1.29" fill="#fff" opacity="0.83" />
        <circle cx="106.7" cy="286.9" r="0.41" fill="#fff" opacity="0.58" />
        <circle cx="234.3" cy="132.3" r="0.52" fill="#fff" opacity="0.99" />
        <circle cx="182.5" cy="261.7" r="1.16" fill="#fff" opacity="0.65" />
        <circle cx="50.0" cy="238.0" r="1.57" fill="#fff" opacity="0.52" />
        <circle cx="9.8" cy="46.3" r="1.32" fill="#fff" opacity="0.80" />
        <circle cx="264.1" cy="260.9" r="0.70" fill="#fff" opacity="0.89" />
        <circle cx="67.5" cy="11.2" r="0.51" fill="#fff" opacity="0.36" />
        <circle cx="214.8" cy="249.2" r="1.50" fill="#fff" opacity="0.44" />
        <circle cx="197.6" cy="15.6" r="0.76" fill="#fff" opacity="0.67" />
        <circle cx="25.6" cy="106.7" r="0.70" fill="#fff" opacity="0.54" />
        <circle cx="316.2" cy="41.0" r="0.61" fill="#fff" opacity="0.35" />
        <circle cx="249.6" cy="25.9" r="0.92" fill="#fff" opacity="0.42" />
        <circle cx="191.2" cy="124.4" r="0.41" fill="#fff" opacity="0.84" />
        <circle cx="180.6" cy="221.7" r="0.84" fill="#fff" opacity="0.95" />
        <circle cx="286.8" cy="191.8" r="0.75" fill="#fff" opacity="0.58" />
        <circle cx="30.9" cy="264.3" r="0.51" fill="#fff" opacity="0.39" />
        <circle cx="74.5" cy="91.2" r="0.44" fill="#fff" opacity="0.74" />
        <circle cx="175.8" cy="113.2" r="1.10" fill="#fff" opacity="0.94" />
        <circle cx="211.3" cy="126.5" r="0.56" fill="#fff" opacity="0.93" />
        <circle cx="264.8" cy="149.7" r="1.58" fill="#fff" opacity="0.79" />
        <circle cx="183.4" cy="290.1" r="1.55" fill="#fff" opacity="0.62" />
        <circle cx="199.1" cy="210.8" r="1.42" fill="#fff" opacity="0.94" />
        <circle cx="218.0" cy="297.0" r="1.23" fill="#fff" opacity="0.89" />
        <circle cx="176.1" cy="22.6" r="1.66" fill="#fff" opacity="0.71" />
        <circle cx="260.9" cy="117.4" r="1.38" fill="#fff" opacity="0.86" />
        <circle cx="200.9" cy="133.2" r="1.55" fill="#fff" opacity="0.82" />
        <circle cx="20.7" cy="110.7" r="1.01" fill="#fff" opacity="0.99" />
        <circle cx="263.5" cy="46.2" r="1.28" fill="#fff" opacity="0.46" />
        <circle cx="80.0" cy="158.3" r="0.81" fill="#fff" opacity="0.36" />
        <circle cx="383.8" cy="154.3" r="0.45" fill="#fff" opacity="0.60" />
        <circle cx="73.6" cy="197.3" r="0.70" fill="#fff" opacity="0.83" />
        <circle cx="122.2" cy="272.3" r="1.18" fill="#fff" opacity="0.61" />
        <circle cx="332.1" cy="53.5" r="0.85" fill="#fff" opacity="0.62" />
        <circle cx="357.7" cy="170.5" r="0.51" fill="#fff" opacity="0.46" />
        <circle cx="193.9" cy="75.2" r="0.92" fill="#fff" opacity="0.68" />
        <circle cx="132.2" cy="8.3" r="0.48" fill="#fff" opacity="0.83" />
        <circle cx="182.5" cy="166.0" r="1.57" fill="#fff" opacity="0.42" />
        <circle cx="162.0" cy="67.0" r="0.91" fill="#fff" opacity="0.37" />
        <circle cx="50.9" cy="218.5" r="1.51" fill="#fff" opacity="0.37" />
        <circle cx="214.7" cy="83.7" r="0.85" fill="#fff" opacity="0.50" />
        <circle cx="293.0" cy="147.6" r="0.70" fill="#fff" opacity="0.76" />
        <circle cx="354.7" cy="284.4" r="0.90" fill="#fff" opacity="0.96" />
        <circle cx="321.0" cy="123.6" r="0.51" fill="#fff" opacity="0.49" />
        <circle cx="53.6" cy="217.2" r="1.16" fill="#fff" opacity="0.98" />
        <circle cx="110.4" cy="105.8" r="0.82" fill="#fff" opacity="0.45" />
        <circle cx="368.1" cy="185.8" r="1.43" fill="#fff" opacity="0.81" />
        <circle cx="110.5" cy="175.6" r="0.57" fill="#fff" opacity="0.81" />
        <circle cx="384.7" cy="182.8" r="0.83" fill="#fff" opacity="0.57" />
        <circle cx="222.6" cy="170.1" r="0.56" fill="#fff" opacity="0.60" />
        <circle cx="330.4" cy="223.0" r="1.09" fill="#fff" opacity="0.69" />
        <circle cx="244.1" cy="115.3" r="0.51" fill="#fff" opacity="0.44" />
        <circle cx="151.1" cy="276.7" r="1.38" fill="#fff" opacity="0.95" />
        <circle cx="180.0" cy="259.2" r="0.97" fill="#fff" opacity="0.41" />
        <circle cx="355.3" cy="103.3" r="0.72" fill="#fff" opacity="0.51" />
        <circle cx="20.4" cy="105.5" r="0.85" fill="#fff" opacity="0.99" />
        <circle cx="325.8" cy="184.3" r="1.10" fill="#fff" opacity="0.38" />
        <circle cx="185.1" cy="47.0" r="1.03" fill="#fff" opacity="0.55" />
        <circle cx="97.1" cy="156.6" r="1.14" fill="#fff" opacity="0.49" />
        <circle cx="234.6" cy="198.3" r="1.04" fill="#fff" opacity="0.41" />
        <circle cx="0.1" cy="146.2" r="1.00" fill="#fff" opacity="0.35" />
        <circle cx="247.8" cy="29.8" r="0.51" fill="#fff" opacity="0.55" />
        <circle cx="173.0" cy="201.2" r="1.65" fill="#fff" opacity="0.92" />
        <circle cx="66.9" cy="0.9" r="1.49" fill="#fff" opacity="1.00" />
        <circle cx="339.3" cy="225.3" r="1.14" fill="#fff" opacity="0.94" />
        <circle cx="7.7" cy="92.9" r="1.20" fill="#fff" opacity="0.39" />
        <circle cx="252.2" cy="111.2" r="0.79" fill="#fff" opacity="0.97" />
        <circle cx="238.3" cy="43.0" r="1.29" fill="#fff" opacity="0.81" />
        <circle cx="5.4" cy="73.6" r="0.56" fill="#fff" opacity="0.56" /></svg
    ></div>
    <div class="parallax-layer" style="--parallax-speed: 52%; z-index: -6"
      ><svg viewBox="0 0 400 300" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
        <defs>
          <radialGradient id="glow">
            <stop offset="0" stop-color="#fff6d6" />
            <stop offset=".35" stop-color="#ffe9a8" stop-opacity=".9" />
            <stop offset="1" stop-color="#ffe9a8" stop-opacity="0" />
          </radialGradient>
        </defs>
        <circle cx="290" cy="95" r="60" fill="url(#glow)" />
        <circle cx="290" cy="95" r="22" fill="#fff8e1" /></svg
    ></div>
    <div class="parallax-layer" style="--parallax-speed: 20%; z-index: -5">
      <h2
        style="
          margin: 0;
          color: #fff;
          font-size: clamp(2.5rem, 8vw, 4.5rem);
          font-weight: 800;
          letter-spacing: -0.04em;
          text-shadow: 0 4px 30px rgb(0 0 0 / 0.4);
        "
        >Into the night</h2
      >
    </div>
    <div class="parallax-layer" style="--parallax-speed: 34%; z-index: -4"
      ><svg viewBox="0 0 400 300" preserveAspectRatio="xMidYMax slice" aria-hidden="true">
        <path
          d="M0 210 L40 170 L80 195 L130 140 L180 185 L230 130 L280 180 L330 145 L400 190 V300 H0Z"
          fill="#3d2a66"
        /></svg
    ></div>
    <div class="parallax-layer" style="--parallax-speed: 22%; z-index: -3"
      ><svg viewBox="0 0 400 300" preserveAspectRatio="xMidYMax slice" aria-hidden="true">
        <path d="M0 235 L60 185 L110 225 L170 170 L230 220 L300 175 L360 215 L400 195 V300 H0Z" fill="#2b1d4d" /></svg
    ></div>
    <div class="parallax-layer" style="--parallax-speed: 10%; z-index: -2"
      ><svg viewBox="0 0 400 300" preserveAspectRatio="xMidYMax slice" aria-hidden="true">
        <path d="M0 255 Q80 215 160 248 T320 240 T400 236 V300 H0Z" fill="#1b1335" /></svg
    ></div>
    <div class="parallax-layer" style="--parallax-speed: -18%; z-index: -1"
      ><svg viewBox="0 0 400 300" preserveAspectRatio="xMidYMax slice" aria-hidden="true">
        <path
          d="M0 300 V275 L4 266 L9 245 L14 266 L19 275 L23 261.2 L28 229 L33 261.2 L38 275 L42 256.4 L47 213 L52 256.4 L57 275 L61 262.4 L66 233 L71 262.4 L76 275 L80 257.6 L85 217 L90 257.6 L95 275 L99 258.8 L104 221 L109 258.8 L114 275 L118 264.8 L123 241 L128 264.8 L133 275 L137 260 L142 225 L147 260 L152 275 L156 255.2 L161 209 L166 255.2 L171 275 L175 261.2 L180 229 L185 261.2 L190 275 L194 262.4 L199 233 L204 262.4 L209 275 L213 257.6 L218 217 L223 257.6 L228 275 L232 263.6 L237 237 L242 263.6 L247 275 L251 258.8 L256 221 L261 258.8 L266 275 L270 254 L275 205 L280 254 L285 275 L289 266 L294 245 L299 266 L304 275 L308 261.2 L313 229 L318 261.2 L323 275 L327 256.4 L332 213 L337 256.4 L342 275 L346 262.4 L351 233 L356 262.4 L361 275 L365 257.6 L370 217 L375 257.6 L380 275 L384 258.8 L389 221 L394 258.8 L399 275 L403 264.8 L408 241 L413 264.8 L418 275 V300Z"
          fill="#0a0716"
        /></svg
    ></div>
  </section>
  <p style="display: grid; place-items: center; height: 28rem; margin: 0; color: var(--muted-foreground)"
    >↑ Scroll back up</p
  >
</div>
```

```html example label="Fly through (sticky)" hint="data-sticky + .parallax-stage: the stage pins for four screens of scrolling (--parallax-length: 4) and the layers play over that stretch - the star field zooms (data-motion='zoom'), the rings zoom and fade, the spokes spin, and three words pass by one after another (data-motion='pass', each with its own animation-range)." previewStyle="align-items:stretch;"
<div
  style="
    height: 30rem;
    overflow: auto;
    overscroll-behavior: contain;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
  "
>
  <p style="display: grid; place-items: center; height: 12rem; margin: 0; color: var(--muted-foreground)"
    >Scroll down ↓</p
  >
  <section class="parallax" data-sticky style="--parallax-stage: 30rem; --parallax-length: 4" aria-label="Fly through">
    <div
      class="parallax-stage"
      style="background: radial-gradient(circle at 50% 50%, #1a1f4a, #05060f 70%); color: #fff"
    >
      <div class="parallax-layer" data-motion="zoom" style="--parallax-scale: 4"
        ><svg viewBox="0 0 400 400" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
          <circle cx="22.7" cy="102.7" r="1.05" fill="#fff" opacity="0.70" />
          <circle cx="211.2" cy="377.2" r="0.52" fill="#fff" opacity="0.58" />
          <circle cx="32.7" cy="57.5" r="0.59" fill="#fff" opacity="0.56" />
          <circle cx="45.1" cy="131.3" r="0.53" fill="#fff" opacity="0.62" />
          <circle cx="125.0" cy="326.8" r="1.00" fill="#fff" opacity="0.69" />
          <circle cx="356.3" cy="268.8" r="0.86" fill="#fff" opacity="0.83" />
          <circle cx="186.0" cy="100.5" r="1.42" fill="#fff" opacity="0.52" />
          <circle cx="246.1" cy="172.6" r="1.00" fill="#fff" opacity="0.91" />
          <circle cx="42.8" cy="198.6" r="0.95" fill="#fff" opacity="0.50" />
          <circle cx="312.0" cy="277.2" r="0.66" fill="#fff" opacity="0.82" />
          <circle cx="41.3" cy="181.4" r="1.38" fill="#fff" opacity="0.39" />
          <circle cx="159.0" cy="113.5" r="0.40" fill="#fff" opacity="0.64" />
          <circle cx="290.0" cy="128.0" r="0.44" fill="#fff" opacity="0.67" />
          <circle cx="177.2" cy="219.8" r="0.42" fill="#fff" opacity="0.86" />
          <circle cx="171.5" cy="280.3" r="1.40" fill="#fff" opacity="0.40" />
          <circle cx="386.4" cy="319.5" r="1.61" fill="#fff" opacity="0.50" />
          <circle cx="120.6" cy="154.5" r="1.58" fill="#fff" opacity="0.80" />
          <circle cx="347.0" cy="165.7" r="0.90" fill="#fff" opacity="0.86" />
          <circle cx="68.0" cy="318.4" r="1.14" fill="#fff" opacity="0.73" />
          <circle cx="138.0" cy="252.2" r="0.52" fill="#fff" opacity="0.64" />
          <circle cx="152.1" cy="36.2" r="1.08" fill="#fff" opacity="0.51" />
          <circle cx="1.5" cy="391.4" r="1.21" fill="#fff" opacity="0.51" />
          <circle cx="96.2" cy="379.5" r="0.71" fill="#fff" opacity="0.82" />
          <circle cx="253.4" cy="158.5" r="1.49" fill="#fff" opacity="0.41" />
          <circle cx="53.5" cy="5.1" r="1.37" fill="#fff" opacity="0.91" />
          <circle cx="261.8" cy="3.1" r="0.42" fill="#fff" opacity="0.47" />
          <circle cx="117.8" cy="399.4" r="0.42" fill="#fff" opacity="0.37" />
          <circle cx="90.7" cy="226.2" r="1.19" fill="#fff" opacity="0.43" />
          <circle cx="101.4" cy="189.7" r="0.52" fill="#fff" opacity="0.67" />
          <circle cx="11.8" cy="225.5" r="1.32" fill="#fff" opacity="0.80" />
          <circle cx="379.7" cy="121.4" r="1.55" fill="#fff" opacity="0.78" />
          <circle cx="281.8" cy="5.8" r="0.57" fill="#fff" opacity="0.56" />
          <circle cx="202.0" cy="303.4" r="1.16" fill="#fff" opacity="0.85" />
          <circle cx="387.3" cy="357.4" r="0.70" fill="#fff" opacity="0.46" />
          <circle cx="269.6" cy="118.3" r="1.44" fill="#fff" opacity="0.57" />
          <circle cx="155.3" cy="99.9" r="0.81" fill="#fff" opacity="0.95" />
          <circle cx="380.0" cy="0.7" r="0.81" fill="#fff" opacity="0.55" />
          <circle cx="331.5" cy="393.8" r="1.39" fill="#fff" opacity="0.49" />
          <circle cx="138.1" cy="281.5" r="1.13" fill="#fff" opacity="0.88" />
          <circle cx="224.6" cy="118.2" r="1.45" fill="#fff" opacity="0.84" />
          <circle cx="334.1" cy="298.9" r="1.29" fill="#fff" opacity="0.74" />
          <circle cx="17.3" cy="315.0" r="1.69" fill="#fff" opacity="0.42" />
          <circle cx="187.7" cy="176.3" r="0.89" fill="#fff" opacity="0.45" />
          <circle cx="144.1" cy="100.2" r="0.72" fill="#fff" opacity="0.46" />
          <circle cx="59.4" cy="67.0" r="0.76" fill="#fff" opacity="0.67" />
          <circle cx="136.0" cy="41.9" r="1.29" fill="#fff" opacity="0.46" />
          <circle cx="28.2" cy="64.6" r="0.52" fill="#fff" opacity="0.73" />
          <circle cx="131.1" cy="204.1" r="0.50" fill="#fff" opacity="0.74" />
          <circle cx="336.1" cy="381.6" r="0.92" fill="#fff" opacity="0.68" />
          <circle cx="253.0" cy="58.6" r="1.58" fill="#fff" opacity="0.70" />
          <circle cx="99.2" cy="193.2" r="0.49" fill="#fff" opacity="0.43" />
          <circle cx="254.8" cy="261.9" r="0.65" fill="#fff" opacity="0.86" />
          <circle cx="285.3" cy="348.8" r="0.86" fill="#fff" opacity="0.78" />
          <circle cx="230.2" cy="300.7" r="1.58" fill="#fff" opacity="0.82" />
          <circle cx="158.6" cy="349.7" r="1.34" fill="#fff" opacity="0.81" />
          <circle cx="391.6" cy="2.1" r="0.52" fill="#fff" opacity="0.76" />
          <circle cx="390.8" cy="393.5" r="0.74" fill="#fff" opacity="0.39" />
          <circle cx="314.3" cy="111.6" r="1.26" fill="#fff" opacity="0.95" />
          <circle cx="38.7" cy="84.9" r="1.44" fill="#fff" opacity="0.44" />
          <circle cx="47.8" cy="338.1" r="1.45" fill="#fff" opacity="0.87" />
          <circle cx="188.6" cy="214.2" r="1.28" fill="#fff" opacity="0.41" />
          <circle cx="293.1" cy="64.1" r="0.57" fill="#fff" opacity="0.88" />
          <circle cx="267.7" cy="1.2" r="0.66" fill="#fff" opacity="0.75" />
          <circle cx="48.0" cy="124.3" r="0.96" fill="#fff" opacity="0.94" />
          <circle cx="221.7" cy="206.2" r="1.39" fill="#fff" opacity="0.58" />
          <circle cx="117.2" cy="49.5" r="0.55" fill="#fff" opacity="0.47" />
          <circle cx="159.2" cy="108.3" r="1.17" fill="#fff" opacity="0.35" />
          <circle cx="90.9" cy="377.9" r="0.86" fill="#fff" opacity="0.61" />
          <circle cx="263.0" cy="349.6" r="0.68" fill="#fff" opacity="0.44" />
          <circle cx="389.0" cy="33.2" r="1.47" fill="#fff" opacity="0.39" />
          <circle cx="167.6" cy="46.0" r="1.15" fill="#fff" opacity="0.77" />
          <circle cx="171.8" cy="368.3" r="0.62" fill="#fff" opacity="0.47" />
          <circle cx="203.9" cy="165.4" r="1.44" fill="#fff" opacity="0.85" />
          <circle cx="318.4" cy="277.0" r="0.53" fill="#fff" opacity="0.83" />
          <circle cx="110.2" cy="372.1" r="1.23" fill="#fff" opacity="0.98" />
          <circle cx="270.8" cy="371.7" r="0.64" fill="#fff" opacity="0.84" />
          <circle cx="9.9" cy="137.6" r="1.15" fill="#fff" opacity="0.57" />
          <circle cx="344.9" cy="227.8" r="0.78" fill="#fff" opacity="0.45" />
          <circle cx="56.1" cy="118.8" r="1.23" fill="#fff" opacity="0.81" />
          <circle cx="308.8" cy="294.6" r="1.30" fill="#fff" opacity="0.44" />
          <circle cx="342.6" cy="202.0" r="1.44" fill="#fff" opacity="0.62" />
          <circle cx="226.6" cy="73.3" r="1.49" fill="#fff" opacity="0.54" />
          <circle cx="281.8" cy="214.5" r="0.53" fill="#fff" opacity="0.86" />
          <circle cx="369.9" cy="161.4" r="1.47" fill="#fff" opacity="0.62" />
          <circle cx="249.0" cy="101.8" r="0.98" fill="#fff" opacity="0.46" />
          <circle cx="195.5" cy="164.0" r="1.01" fill="#fff" opacity="0.96" />
          <circle cx="293.5" cy="372.7" r="0.44" fill="#fff" opacity="0.89" />
          <circle cx="389.8" cy="71.1" r="0.56" fill="#fff" opacity="0.36" />
          <circle cx="316.6" cy="9.8" r="1.01" fill="#fff" opacity="0.54" />
          <circle cx="380.1" cy="302.5" r="0.52" fill="#fff" opacity="0.56" />
          <circle cx="115.9" cy="247.8" r="1.11" fill="#fff" opacity="0.67" />
          <circle cx="111.9" cy="18.6" r="1.40" fill="#fff" opacity="0.67" />
          <circle cx="96.3" cy="217.4" r="1.28" fill="#fff" opacity="0.70" />
          <circle cx="93.8" cy="98.5" r="0.88" fill="#fff" opacity="0.52" />
          <circle cx="247.8" cy="57.0" r="0.43" fill="#fff" opacity="0.49" />
          <circle cx="108.8" cy="384.2" r="0.97" fill="#fff" opacity="0.46" />
          <circle cx="190.3" cy="290.0" r="0.76" fill="#fff" opacity="0.99" />
          <circle cx="191.2" cy="391.7" r="1.59" fill="#fff" opacity="0.43" />
          <circle cx="284.2" cy="269.6" r="0.48" fill="#fff" opacity="0.92" />
          <circle cx="271.9" cy="288.9" r="1.59" fill="#fff" opacity="0.58" />
          <circle cx="208.6" cy="89.4" r="0.53" fill="#fff" opacity="0.92" />
          <circle cx="89.3" cy="140.1" r="0.65" fill="#fff" opacity="0.57" />
          <circle cx="205.4" cy="361.9" r="1.66" fill="#fff" opacity="0.36" />
          <circle cx="166.7" cy="216.7" r="0.72" fill="#fff" opacity="0.45" />
          <circle cx="190.7" cy="262.4" r="1.07" fill="#fff" opacity="0.47" />
          <circle cx="257.4" cy="375.7" r="0.52" fill="#fff" opacity="0.76" />
          <circle cx="332.3" cy="240.3" r="0.44" fill="#fff" opacity="0.75" />
          <circle cx="55.0" cy="103.3" r="1.30" fill="#fff" opacity="0.43" />
          <circle cx="294.6" cy="196.8" r="1.64" fill="#fff" opacity="0.92" />
          <circle cx="172.0" cy="26.9" r="0.53" fill="#fff" opacity="0.95" />
          <circle cx="349.0" cy="329.4" r="0.90" fill="#fff" opacity="0.86" />
          <circle cx="183.6" cy="92.0" r="0.69" fill="#fff" opacity="0.63" />
          <circle cx="352.4" cy="243.1" r="0.58" fill="#fff" opacity="0.84" />
          <circle cx="139.2" cy="7.3" r="0.74" fill="#fff" opacity="0.91" />
          <circle cx="191.1" cy="327.9" r="1.14" fill="#fff" opacity="0.96" />
          <circle cx="340.2" cy="355.6" r="1.45" fill="#fff" opacity="0.85" />
          <circle cx="92.5" cy="203.8" r="1.68" fill="#fff" opacity="0.36" />
          <circle cx="183.9" cy="371.3" r="1.26" fill="#fff" opacity="0.40" />
          <circle cx="2.0" cy="231.0" r="1.40" fill="#fff" opacity="0.76" />
          <circle cx="75.3" cy="385.4" r="0.71" fill="#fff" opacity="0.94" />
          <circle cx="28.5" cy="88.7" r="0.60" fill="#fff" opacity="0.68" />
          <circle cx="4.7" cy="136.1" r="1.31" fill="#fff" opacity="0.36" />
          <circle cx="354.5" cy="18.9" r="1.27" fill="#fff" opacity="0.49" />
          <circle cx="391.6" cy="146.9" r="1.34" fill="#fff" opacity="0.94" />
          <circle cx="214.7" cy="337.5" r="0.73" fill="#fff" opacity="0.74" />
          <circle cx="396.6" cy="170.9" r="1.64" fill="#fff" opacity="0.73" />
          <circle cx="339.9" cy="12.5" r="0.44" fill="#fff" opacity="0.96" />
          <circle cx="98.8" cy="301.8" r="0.54" fill="#fff" opacity="0.36" />
          <circle cx="68.4" cy="308.0" r="1.38" fill="#fff" opacity="0.80" />
          <circle cx="140.0" cy="352.1" r="1.37" fill="#fff" opacity="0.52" />
          <circle cx="323.6" cy="295.8" r="1.60" fill="#fff" opacity="0.97" />
          <circle cx="36.4" cy="297.1" r="1.37" fill="#fff" opacity="0.49" />
          <circle cx="58.7" cy="232.5" r="1.10" fill="#fff" opacity="0.71" />
          <circle cx="355.8" cy="186.1" r="0.87" fill="#fff" opacity="0.40" />
          <circle cx="167.4" cy="4.6" r="1.16" fill="#fff" opacity="0.88" />
          <circle cx="362.5" cy="320.3" r="0.49" fill="#fff" opacity="0.65" />
          <circle cx="62.2" cy="239.3" r="0.54" fill="#fff" opacity="0.39" />
          <circle cx="328.1" cy="97.4" r="1.62" fill="#fff" opacity="0.45" />
          <circle cx="118.2" cy="82.2" r="0.41" fill="#fff" opacity="0.79" />
          <circle cx="109.2" cy="322.1" r="1.45" fill="#fff" opacity="0.71" /></svg
      ></div>
      <div class="parallax-layer" data-motion="zoom fade" style="--parallax-scale: 6"
        ><svg viewBox="0 0 400 400" preserveAspectRatio="xMidYMid meet" aria-hidden="true">
          <circle cx="200" cy="200" r="60" fill="none" stroke="#7c8cff" stroke-width="1.5" opacity=".7" />
          <circle cx="200" cy="200" r="110" fill="none" stroke="#b07cff" stroke-width="1" opacity=".5" />
          <circle cx="200" cy="200" r="170" fill="none" stroke="#7cf0ff" stroke-width=".8" opacity=".35" /></svg
      ></div>
      <div class="parallax-layer" data-motion="pass" style="animation-range: contain 0% contain 40%; z-index: 1"
        ><p
          style="
            margin: 0;
            font-size: clamp(3rem, 10vw, 6rem);
            font-weight: 800;
            letter-spacing: -0.04em;
            background: linear-gradient(90deg, #9db2ff, #e3a6ff);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
          "
          >Plan.</p
        ></div
      >
      <div class="parallax-layer" data-motion="pass" style="animation-range: contain 30% contain 70%; z-index: 2"
        ><p
          style="
            margin: 0;
            font-size: clamp(3rem, 10vw, 6rem);
            font-weight: 800;
            letter-spacing: -0.04em;
            background: linear-gradient(90deg, #9db2ff, #e3a6ff);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
          "
          >Write.</p
        ></div
      >
      <div class="parallax-layer" data-motion="pass" style="animation-range: contain 60% contain 100%; z-index: 3"
        ><p
          style="
            margin: 0;
            font-size: clamp(3rem, 10vw, 6rem);
            font-weight: 800;
            letter-spacing: -0.04em;
            background: linear-gradient(90deg, #9db2ff, #e3a6ff);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
          "
          >Ship.</p
        ></div
      >
      <div
        class="parallax-layer"
        data-motion="spin"
        style="--parallax-turn: 180deg; --parallax-speed: 0%; z-index: -1; opacity: 0.25"
        ><svg viewBox="0 0 400 400" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
          <g fill="none" stroke="#fff" stroke-width=".6">
            <line x1="200" y1="200" x2="460.0" y2="200.0" />
            <line x1="200" y1="200" x2="425.2" y2="330.0" />
            <line x1="200" y1="200" x2="330.0" y2="425.2" />
            <line x1="200" y1="200" x2="200.0" y2="460.0" />
            <line x1="200" y1="200" x2="70.0" y2="425.2" />
            <line x1="200" y1="200" x2="-25.2" y2="330.0" />
            <line x1="200" y1="200" x2="-60.0" y2="200.0" />
            <line x1="200" y1="200" x2="-25.2" y2="70.0" />
            <line x1="200" y1="200" x2="70.0" y2="-25.2" />
            <line x1="200" y1="200" x2="200.0" y2="-60.0" />
            <line x1="200" y1="200" x2="330.0" y2="-25.2" />
            <line x1="200" y1="200" x2="425.2" y2="70.0" />
          </g></svg
      ></div>
    </div>
  </section>
  <p style="display: grid; place-items: center; height: 12rem; margin: 0; color: var(--muted-foreground)"
    >↑ Scroll back up</p
  >
</div>
```

```html example label="Drifting photo wall" hint=".parallax-drift moves in-flow elements by their own --parallax-speed (a length here): the three columns slide past each other at -7rem, 7rem and -12rem as the wall scrolls by." previewStyle="align-items:stretch;"
<div
  style="
    height: 32rem;
    overflow: auto;
    overscroll-behavior: contain;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
  "
>
  <p style="display: grid; place-items: center; height: 18rem; margin: 0; color: var(--muted-foreground)"
    >Scroll down ↓</p
  >
  <div style="display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; padding: 2rem 1.25rem">
    <div class="parallax-drift" style="--parallax-speed: -7rem; display: grid; gap: 1rem">
      <img
        src="images/mk-wide.png"
        alt=""
        style="display: block; width: 100%; height: 10rem; object-fit: cover; border-radius: var(--radius-lg)"
      />
      <img
        src="images/mk-portrait.png"
        alt=""
        style="display: block; width: 100%; height: 14rem; object-fit: cover; border-radius: var(--radius-lg)"
      />
      <img
        src="images/mk-square.png"
        alt=""
        style="display: block; width: 100%; height: 12rem; object-fit: cover; border-radius: var(--radius-lg)"
      />
      <img
        src="images/mk-wide3.png"
        alt=""
        style="display: block; width: 100%; height: 9rem; object-fit: cover; border-radius: var(--radius-lg)"
      />
    </div>
    <div class="parallax-drift" style="--parallax-speed: 7rem; display: grid; gap: 1rem">
      <img
        src="images/mk-portrait2.png"
        alt=""
        style="display: block; width: 100%; height: 14rem; object-fit: cover; border-radius: var(--radius-lg)"
      />
      <img
        src="images/mk-wide2.png"
        alt=""
        style="display: block; width: 100%; height: 12rem; object-fit: cover; border-radius: var(--radius-lg)"
      />
      <img
        src="images/mk-portrait.png"
        alt=""
        style="display: block; width: 100%; height: 9rem; object-fit: cover; border-radius: var(--radius-lg)"
      />
      <img
        src="images/mk-square.png"
        alt=""
        style="display: block; width: 100%; height: 10rem; object-fit: cover; border-radius: var(--radius-lg)"
      />
    </div>
    <div class="parallax-drift" style="--parallax-speed: -12rem; display: grid; gap: 1rem">
      <img
        src="images/mk-square.png"
        alt=""
        style="display: block; width: 100%; height: 12rem; object-fit: cover; border-radius: var(--radius-lg)"
      />
      <img
        src="images/mk-wide3.png"
        alt=""
        style="display: block; width: 100%; height: 9rem; object-fit: cover; border-radius: var(--radius-lg)"
      />
      <img
        src="images/mk-portrait2.png"
        alt=""
        style="display: block; width: 100%; height: 10rem; object-fit: cover; border-radius: var(--radius-lg)"
      />
      <img
        src="images/mk-wide.png"
        alt=""
        style="display: block; width: 100%; height: 14rem; object-fit: cover; border-radius: var(--radius-lg)"
      />
    </div>
  </div>
  <p style="display: grid; place-items: center; height: 18rem; margin: 0; color: var(--muted-foreground)"
    >↑ Scroll back up</p
  >
</div>
```

```html example label="Photo hero" hint="The classic: the photo lags (40%), the copy leads (-35%) and fades out (data-motion='fade')." previewStyle="align-items:stretch;"
<div
  style="
    height: 30rem;
    overflow: auto;
    overscroll-behavior: contain;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
  "
>
  <p style="display: grid; place-items: center; height: 30rem; margin: 0; color: var(--muted-foreground)"
    >Scroll down ↓</p
  >
  <section class="parallax" style="height: 30rem; background: #000" aria-label="A parallax hero">
    <div class="parallax-layer" style="--parallax-speed: 40%"><img src="images/mk-wide3.png" alt="" /></div>
    <div
      class="parallax-layer"
      style="
        --parallax-speed: 40%;
        z-index: 0;
        background: linear-gradient(to top, rgb(0 0 0 / 0.7), rgb(0 0 0 / 0.1) 60%);
      "
    ></div>
    <div
      class="parallax-layer"
      data-motion="fade"
      style="--parallax-speed: -35%; z-index: 1; color: #fff; text-align: center"
    >
      <div
        ><p style="margin: 0; font-size: 0.875rem; letter-spacing: 0.2em; text-transform: uppercase; opacity: 0.8"
          >Acme 4.0</p
        ><h2 style="margin: 0.5rem 0 0; font-size: clamp(2.5rem, 7vw, 4rem); font-weight: 800; letter-spacing: -0.04em"
          >Ship calmly.</h2
        ></div
      >
    </div>
  </section>
  <p style="display: grid; place-items: center; height: 30rem; margin: 0; color: var(--muted-foreground)"
    >↑ Scroll back up</p
  >
</div>
```

```html example label="Staggered reveals" hint=".parallax-reveal rises cards into view - data-reveal='zoom' grows them, 'fade' only fades, --parallax-rise varies the lift so the grid ripples in." previewStyle="align-items:stretch;"
<div
  style="
    height: 30rem;
    overflow: auto;
    overscroll-behavior: contain;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
  "
>
  <p style="display: grid; place-items: center; height: 16rem; margin: 0; color: var(--muted-foreground)"
    >Scroll down ↓</p
  >
  <div
    style="
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
      gap: 1.25rem;
      padding: 0 1.25rem 2rem;
    "
  >
    <div class="card parallax-reveal" style="padding: 1.5rem; min-height: 9rem; --parallax-rise: 3rem"
      ><strong>Plan</strong
      ><p style="margin: 0.375rem 0 0; color: var(--muted-foreground); font-size: 0.875rem"
        >rise - as it scrolls in</p
      ></div
    >
    <div
      class="card parallax-reveal"
      data-reveal="zoom"
      style="padding: 1.5rem; min-height: 9rem; --parallax-rise: 5rem"
      ><strong>Write</strong
      ><p style="margin: 0.375rem 0 0; color: var(--muted-foreground); font-size: 0.875rem"
        >zoom - as it scrolls in</p
      ></div
    >
    <div
      class="card parallax-reveal"
      data-reveal="fade"
      style="padding: 1.5rem; min-height: 9rem; --parallax-rise: 7rem"
      ><strong>Review</strong
      ><p style="margin: 0.375rem 0 0; color: var(--muted-foreground); font-size: 0.875rem"
        >fade - as it scrolls in</p
      ></div
    >
    <div class="card parallax-reveal" style="padding: 1.5rem; min-height: 9rem; --parallax-rise: 3rem"
      ><strong>Ship</strong
      ><p style="margin: 0.375rem 0 0; color: var(--muted-foreground); font-size: 0.875rem"
        >rise - as it scrolls in</p
      ></div
    >
    <div
      class="card parallax-reveal"
      data-reveal="zoom"
      style="padding: 1.5rem; min-height: 9rem; --parallax-rise: 5rem"
      ><strong>Measure</strong
      ><p style="margin: 0.375rem 0 0; color: var(--muted-foreground); font-size: 0.875rem"
        >zoom - as it scrolls in</p
      ></div
    >
    <div class="card parallax-reveal" style="padding: 1.5rem; min-height: 9rem; --parallax-rise: 7rem"
      ><strong>Learn</strong
      ><p style="margin: 0.375rem 0 0; color: var(--muted-foreground); font-size: 0.875rem"
        >rise - as it scrolls in</p
      ></div
    >
    <div
      class="card parallax-reveal"
      data-reveal="fade"
      style="padding: 1.5rem; min-height: 9rem; --parallax-rise: 3rem"
      ><strong>Repeat</strong
      ><p style="margin: 0.375rem 0 0; color: var(--muted-foreground); font-size: 0.875rem"
        >fade - as it scrolls in</p
      ></div
    >
    <div
      class="card parallax-reveal"
      data-reveal="zoom"
      style="padding: 1.5rem; min-height: 9rem; --parallax-rise: 5rem"
      ><strong>Rest</strong
      ><p style="margin: 0.375rem 0 0; color: var(--muted-foreground); font-size: 0.875rem"
        >zoom - as it scrolls in</p
      ></div
    >
    <div class="card parallax-reveal" style="padding: 1.5rem; min-height: 9rem; --parallax-rise: 7rem"
      ><strong>Celebrate</strong
      ><p style="margin: 0.375rem 0 0; color: var(--muted-foreground); font-size: 0.875rem"
        >rise - as it scrolls in</p
      ></div
    >
  </div>
  <p style="display: grid; place-items: center; height: 16rem; margin: 0; color: var(--muted-foreground)"
    >↑ Scroll back up</p
  >
</div>
```

```html example label="Horizontal" hint="data-axis='inline' for a sideways scroller - sun and clouds, hills and the meadow slide at their own speeds." previewStyle="align-items:stretch;"
<div
  style="
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
  "
>
  <div style="display: flex; width: max-content; align-items: stretch">
    <p style="flex: none; display: grid; place-items: center; width: 24rem; margin: 0; color: var(--muted-foreground)"
      >Scroll sideways →</p
    >
    <section
      class="parallax"
      data-axis="inline"
      style="flex: none; width: 56rem; height: 18rem; background: #bfe3ff"
      aria-label="A sideways scene"
    >
      <div class="parallax-layer" style="--parallax-speed: 40%; z-index: -4"
        ><svg viewBox="0 0 800 300" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
          <circle cx="120" cy="70" r="26" fill="#fff3b0" />
          <g fill="#fff" opacity=".9">
            <ellipse cx="300" cy="60" rx="40" ry="12" />
            <ellipse cx="520" cy="80" rx="55" ry="14" />
            <ellipse cx="700" cy="50" rx="35" ry="10" />
          </g></svg
      ></div>
      <div class="parallax-layer" style="--parallax-speed: 22%; z-index: -3"
        ><svg viewBox="0 0 800 300" preserveAspectRatio="xMidYMax slice" aria-hidden="true">
          <path
            d="M0 210 L80 150 L160 200 L260 130 L360 190 L460 140 L560 200 L660 150 L800 190 V300 H0Z"
            fill="#7aa6c2"
          /></svg
      ></div>
      <div class="parallax-layer" style="--parallax-speed: -12%; z-index: -2"
        ><svg viewBox="0 0 800 300" preserveAspectRatio="xMidYMax slice" aria-hidden="true">
          <path d="M0 250 Q100 215 200 245 T400 240 T600 235 T800 245 V300 H0Z" fill="#3f6f5a" /></svg
      ></div>
      <div class="parallax-content" style="display: grid; place-items: center; height: 100%"
        ><strong style="font-size: 1.5rem">The inline axis</strong></div
      >
    </section>
    <p style="flex: none; display: grid; place-items: center; width: 24rem; margin: 0; color: var(--muted-foreground)"
      >← and back</p
    >
  </div>
</div>
```

<SourceFiles component="parallax" section="css" />

</DocPage>
