CSS timeline-scope allows access to elements that share a common ancestor with the element defining a named scroll timeline. A demo uses this to animate a second carousel while the user scrolls the first carousel.
A scroll timeline or view timeline serves the element that defines it and that element's descendants. timeline-scope changes that limit. When an ancestor receives timeline-scope with the same custom name, any element sharing that ancestor can read the timeline. The ancestor becomes the shared frame.
Wait, I need to translate everything. Let me redo fully.
CSS timeline-scope allows access to elements that share a common ancestor with the element defining a named scroll timeline. A demo uses this to animate a second carousel while the user scrolls the first carousel.
A scroll timeline or view timeline serves only the element that defines it and the descendants of that element. timeline-scope changes that limitation. When an ancestor gets a timeline-scope with the same custom name, any elements shared by that ancestor can read the timeline. The ancestor becomes the general frame.
Two carousels can be under one parent. A carousel scrolls. No need to scroll the other one. The scrolling carousel defines the timeline. The other carousel reads it.
Two carousels
Markup puts the secondary carousel first and the primary carousel second. That sequence supports the intended layout.
€19.90 / ID 485770 €19.90 / ID 485768 €19.90 / ID 485756
The primary carousel allows horizontal scrolling and snap alignment. The secondary carousel clips the overflow and cannot scroll.
.cp { overflow-x: auto; scroll-snap-type: x mandatory; } .cp-slide { scroll-snap-align: center; } .cs { overflow: clip; }
Animation
As the primary carousel scrolls, the secondary carousel slides to the left. The keyframe animation moves the entire carousel by a fraction based on the number of siblings.
@keyframes cs-scroll { to { transform: translateX(calc(-100% * (sibling-count() - 1))); } }
The demo uses sibling-count() to count the children directly. This removes manual indexing in the markup. Support is being introduced, so a fallback can use CSS variables assigned to each item.
Each secondary slide gets animation. No duration is set, as scroll animations follow scroll position rather than clock time.
Registering and sharing timelines
The primary carousel registers a scrolling timeline on the x axis. The secondary slide links its animation to that timeline. An ancestor gets the timeline-scope under the same name.
.cp { overflow-x: auto; scroll-snap-type: x mandatory; scroll-timeline: --carousel-scroll x; } .cs-slide { animation: cs-scroll linear forwards; animation-timeline: --carousel-scroll; } body { timeline-scope: --carousel-scroll; }
body works because it is the parent that both carousels share. Another container can do the same. Carousels share an ancestor with timeline-scope set to the same name.
The same pattern can run multiple children. Each child can use a different animation. A scroll position can trigger many effects.
A video game inventory screen shows the same pattern: a carousel of cars, another of specifications.
Support and usage
timeline-scope is not baseline. Consider it a decorative improvement. If a browser does not support it, the primary carousel still scrolls and the secondary carousel remains stationary.
Use cases include progress indicators and synchronized product views. This effect can help users browse multiple visual focal points with one scroll.




