A scroll or view timeline normally drives only the element that declares it and that element's descendants. The timeline-scope property relaxes that rule: once a shared ancestor carries a timeline scope for a named timeline, every element in that ancestor's subtree can reference it, including siblings of the declaring element.

That makes it possible to let one scrollable carousel drive animation on a second, non-scrolling carousel — useful for synced spec sheets or player profiles, but also for decorative motion in general. Since timeline-scope isn't Baseline yet, treat it as suitable for decorative parts of a page rather than essential functionality.

Video game screenshot showing a carousel of sports cars with a red corvette selected and enlarged next to specifications related to the car.
Source: Pinterest

Markup and scroll behaviour

The demo uses a standard horizontal carousel plus a secondary carousel that never scrolls. The secondary one comes first in the markup because of the intended positioning.

<!-- secondary carousel -->
<div class="cs">
  <ul class="cs-wrapper">
    <li class="cs-slide"></li>
    <li class="cs-slide"></li>
    <li class="cs-slide"></li>
  </ul>
</div>

<!-- primary carousel -->
<ul class="cp">
  <li class="cp-slide">
    <p>€19.90 / ID 485770</p>
  </li>
  <li class="cp-slide">
    <p>€19.90 / ID 485768</p>
  </li>
  <li class="cp-slide">
    <p>€19.90 / ID 485756</p>
  </li>
</ul>

The primary carousel's content is allowed to overflow and scroll horizontally, with scroll snapping so no item is skipped. The secondary carousel's overflow is clipped instead, disabling scrolling entirely.

/* Primary carousel */
.cp {
  /* Allows horizontal scrolling */
  overflow-x: auto;
  /* Snaps slides into place during scrolling */
  scroll-snap-type: x mandatory;
}

.cp-slide {
  /* Sets the snap position to the center of each slide */
  scroll-snap-align: center;
}

/* Secondary carousel */
.cs {
  /* Prevents content from overflowing.
      Disables all scrolling/scrollbars */
  overflow: clip;
}

Keyframes and the shared timeline

The keyframe animation moves the secondary carousel from right to left, showing one item at a time as the primary carousel scrolls. Its item offset relies on sibling-count(), which counts an element's direct children; that function's support is nearing Baseline but not yet production-ready, and the pre-sibling-count() alternative — indexing items with CSS variables in the markup — is considerably more tedious.

@keyframes cs-scroll {
  to {
    /* Moves to the left based on the number of siblings */
    transform: translateX(calc(-100% * (sibling-count() - 1)));
  }
}

The animation is applied to each slide of the secondary carousel, with --carousel-scroll as its animation timeline. That timeline is a scroll timeline declared on the primary carousel's horizontal axis:

/* ... */

/* Secondary carousel */
.cs-slide {
  /* Applies the 'cs-scroll' animation to the slides */
  animation: cs-scroll linear forwards;
}

Duration and delay are pointless here, because progress comes from scroll position rather than a standard timeline. Declaring scroll-timeline with a custom ident on the primary carousel is all that's needed; the secondary carousel picks it up through animation-timeline.

/* Primary carousel */
.cp {
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  /* Defines a scroll timeline based on the x-axis */
  scroll-timeline: --carousel-scroll x;
}

/* Secondary carousel */
.cs-slide {
  /* Applies the 'cs-scroll' animation to the slides */
  animation: cs-scroll linear forwards;
  /* Links the animation progress to the scroll position of #cp */
  animation-timeline: --carousel-scroll;
}

Hoisting the timeline to a common ancestor

The last step is to lift the primary carousel's scroll timeline to <body>, the nearest ancestor the two carousels share. Both are direct children of it, so scoping the timeline there hands it to both.

body {
  /* Lifts the scope of '--carousel-scroll' timeline to the body element 
     so it can be shared between #cp and #cs */
  timeline-scope: --carousel-scroll;
}

If the markup nests the carousels in a dedicated container such as .carousels, the same approach applies with that element as the scope:

/* Parent container */
.carousels {
  /* Shares the scroll time with any descendant */
  timeline-scope: --carousel-scroll;
}

/* Primary carousel */
#cp {
  /* ... */
  scroll-timeline: --carousel-scroll x;
}

/* Secondary carousel */
.cs-slide {
  animation: cs-scroll linear forwards;
  animation-timeline: --carousel-scroll;
}

Any number of children can join in, and they don't have to share one animation — a single scroll position can trigger one or many animations across one or many elements, entirely in vanilla CSS.