property

Timeline scope — CSS reference

Extends the scope of a named timeline so an animation outside the timeline source subtree can resolve it. In this example a sibling marker uses the scroller timeline through their common ancestor.

Formal Syntax & Structure

css syntaxcss
timeline-scope: --reading;

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>timeline-scope</title><style>body{margin:0}#a{padding:8px;background:rgb(232,237,241);color:rgb(0,0,0);box-sizing:border-box}#s{width:240px;height:100px;overflow:auto;position:relative}#space{height:480px}#a{position:sticky;top:0;left:0;width:100px;height:20px;padding:0;animation:fade auto linear both;animation-timeline:scroll(nearest block)}@keyframes fade{from{opacity:0}to{opacity:1}}#wrap{timeline-scope:--reading}#space{height:500px}#s{scroll-timeline:--reading block}#a{position:static;animation-timeline:--reading}@media(prefers-reduced-motion:reduce){#a{animation:none;opacity:1}}</style><body><div id="wrap"><div id="a">Progress marker</div><div id="s" tabindex="0" aria-label="Scroll source"><div id="space"></div></div></div></body></html>
CSS Reference