[{"data":1,"prerenderedAt":2439},["ShallowReactive",2],{"page-\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Ftimeline-scope-for-cross-element-animations":3,"content-all-pages":1875,"live-demo:timeline-scope-toc":2433},{"id":4,"title":5,"body":6,"description":1858,"extension":1859,"meta":1860,"navigation":375,"path":1871,"seo":1872,"stem":1873,"__hash__":1874},"content\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Ftimeline-scope-for-cross-element-animations\u002Findex.md","timeline-scope for Cross-Element Animations",{"type":7,"value":8,"toc":1846},"minimark",[9,13,38,43,66,183,187,190,194,1270,1281,1285,1294,1351,1355,1389,1393,1423,1427,1442,1455,1459,1462,1733,1746,1750,1765,1769,1776,1791,1800,1809,1813,1843],[10,11,5],"h1",{"id":12},"timeline-scope-for-cross-element-animations",[14,15,16,17,21,22,26,27,32,33,37],"p",{},"A view timeline normally drives the element that owns it: a card fades in as the card scrolls into view. Many effects need something different — one element's motion driven by ",[18,19,20],"em",{},"another"," element's scroll position. A table of contents highlights the link for the section currently on screen. A sticky caption changes as each figure passes. A progress dot in a side rail fills as its chapter is read. These elements are siblings or cousins of the thing being tracked, not descendants, and that is exactly what ",[23,24,25],"code",{},"timeline-scope"," makes possible. It lifts a named timeline up to a common ancestor so any element beneath it can animate against it. This page builds a CSS-only scroll spy, explains the lookup rules, and covers what still needs script. It belongs to ",[28,29,31],"a",{"href":30},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002F","Scroll-Driven Animations"," in the ",[28,34,36],{"href":35},"\u002Fcss-only-micro-interactions-animations\u002F","CSS-Only Micro-Interactions & Animations"," guide.",[39,40,42],"h2",{"id":41},"how-named-timelines-are-found","How named timelines are found",[14,44,45,46,49,50,53,54,57,58,61,62,65],{},"A named timeline is declared with ",[23,47,48],{},"view-timeline-name"," (or ",[23,51,52],{},"scroll-timeline-name",") on the element being tracked. An element that says ",[23,55,56],{},"animation-timeline: --intro"," looks for a timeline called ",[23,59,60],{},"--intro"," among its own ancestors, including itself. If the tracked element is a sibling, it is not an ancestor, so the lookup fails. ",[23,63,64],{},"timeline-scope: --intro"," on a shared ancestor changes that: the ancestor now \"owns\" the name, and the timeline declared by any of its descendants is attached to it, visible to every other descendant.",[67,68,74,75,74,79,74,83,74,91,74,102,74,107,74,111,74,119,74,122,74,128,74,132,74,135,74,138,74,143,74,147,74,150,74,153,74,159,74,162,74,164,74,166,74,174,74,178],"svg",{"viewBox":69,"role":70,"ariaLabel":71,"xmlns":72,"style":73},"0 0 720 320","img","Tree diagram: a layout element with timeline-scope contains a nav with a link and a main with a section declaring the timeline; the link can use the timeline because both are descendants of the scoped ancestor","http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg","width:100%;height:auto;max-width:720px;margin:2rem 0","\n  ",[76,77,78],"title",{},"Hoisting a timeline name to a common ancestor",[80,81,82],"desc",{},"A tree. The root node is a layout div with timeline-scope listing the section names. It has two children: nav and main. Under nav is a link animating with animation-timeline --intro. Under main is the intro section declaring view-timeline-name --intro. A dashed arrow from the section rises to the layout node, and another descends to the link, showing the name travelling through the shared ancestor.",[84,85,90],"text",{"textAnchor":86,"x":87,"y":88,"style":89},"middle","360","26","text-anchor:middle;fill:currentColor;font:700 17px sans-serif","The name travels up, then down",[92,93],"rect",{"x":94,"y":95,"width":96,"height":97,"rx":98,"fill":99,"opacity":100,"stroke":99,"strokeWidth":101},"220","48","280","50","8","#7aa2ff","0.3","1.5",[84,103,106],{"textAnchor":86,"x":87,"y":104,"style":105},"70","text-anchor:middle;fill:currentColor;font:600 13px ui-monospace,monospace",".layout",[84,108,64],{"textAnchor":86,"x":87,"y":109,"style":110},"88","text-anchor:middle;fill:currentColor;font:12px ui-monospace,monospace",[92,112],{"x":113,"y":114,"width":115,"height":116,"rx":98,"fill":117,"stroke":118,"strokeWidth":101},"80","140","200","40","none","currentColor",[92,120],{"x":121,"y":114,"width":115,"height":116,"rx":98,"fill":117,"stroke":118,"strokeWidth":101},"440",[84,123,127],{"textAnchor":86,"x":124,"y":125,"style":126},"180","165","text-anchor:middle;fill:currentColor;font:13px ui-monospace,monospace","nav",[84,129,131],{"textAnchor":86,"x":130,"y":125,"style":126},"540","main",[92,133],{"x":116,"y":134,"width":96,"height":97,"rx":98,"fill":117,"stroke":118,"strokeWidth":101},"222",[92,136],{"x":137,"y":134,"width":96,"height":97,"rx":98,"fill":117,"stroke":118,"strokeWidth":101},"400",[84,139,142],{"textAnchor":86,"x":124,"y":140,"style":141},"244","text-anchor:middle;fill:currentColor;font:600 12px ui-monospace,monospace",".toc a (intro link)",[84,144,56],{"textAnchor":86,"x":124,"y":145,"style":146},"262","text-anchor:middle;fill:currentColor;font:11px ui-monospace,monospace",[84,148,149],{"textAnchor":86,"x":130,"y":140,"style":141},"section#intro",[84,151,152],{"textAnchor":86,"x":130,"y":145,"style":146},"view-timeline-name: --intro",[154,155],"line",{"x1":156,"y1":157,"x2":124,"y2":114,"stroke":118,"strokeWidth":101,"opacity":158},"300","98","0.6",[154,160],{"x1":161,"y1":157,"x2":130,"y2":114,"stroke":118,"strokeWidth":101,"opacity":158},"420",[154,163],{"x1":124,"y1":124,"x2":124,"y2":134,"stroke":118,"strokeWidth":101,"opacity":158},[154,165],{"x1":130,"y1":124,"x2":130,"y2":134,"stroke":118,"strokeWidth":101,"opacity":158},[167,168],"path",{"d":169,"fill":117,"stroke":99,"strokeWidth":170,"strokeDashArray":171},"M680 247 C710 180 640 90 500 73","2",[172,173],"6","4",[167,175],{"d":176,"fill":117,"stroke":99,"strokeWidth":170,"strokeDashArray":177},"M220 73 C40 90 10 180 40 247",[172,173],[84,179,182],{"textAnchor":86,"x":87,"y":180,"style":181},"304","text-anchor:middle;fill:currentColor;font:12px sans-serif","Without timeline-scope, the link cannot see a timeline declared on a cousin.",[39,184,186],{"id":185},"the-complete-implementation","The complete implementation",[14,188,189],{},"A two-column layout: a navigation list and a scrolling article. Each section declares a view timeline; the scoped ancestor makes those names visible to the links. Scroll the article in the demo and watch the links.",[191,192],"live-demo",{"name":193},"timeline-scope-toc",[195,196,201],"pre",{"className":197,"code":198,"language":199,"meta":200,"style":200},"language-html shiki shiki-themes github-light-high-contrast github-dark-high-contrast","\u003C!doctype html>\n\u003Chtml lang=\"en\">\n\u003Chead>\n\u003Cmeta charset=\"utf-8\">\n\u003Cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n\u003Ctitle>CSS-only scroll spy\u003C\u002Ftitle>\n\u003Cstyle>\n  body { margin: 0; font: 15px\u002F1.6 system-ui, sans-serif; }\n\n  .layout {\n    display: grid;\n    grid-template-columns: 10rem 1fr;\n    block-size: 100vh;\n    \u002F* Hoist the section timelines so the nav can use them. *\u002F\n    timeline-scope: --intro, --setup, --usage;\n  }\n\n  .toc { padding: 1rem; border-inline-end: 1px solid #cbd5e1; }\n  .toc a {\n    display: block;\n    padding: 0.25rem 0.5rem;\n    border-radius: 6px;\n    color: inherit;\n    text-decoration: none;\n  }\n\n  .article { overflow-y: auto; padding: 0 1.5rem; }\n  .article section { min-block-size: 80vh; padding-block: 1rem; }\n\n  #intro { view-timeline-name: --intro; }\n  #setup { view-timeline-name: --setup; }\n  #usage { view-timeline-name: --usage; }\n\n  @supports (animation-timeline: view()) {\n    .toc a {\n      animation: spy linear both;\n      \u002F* Highlight while the section occupies the middle of the scroller. *\u002F\n      animation-range: cover 30% cover 70%;\n    }\n    .toc a[href=\"#intro\"] { animation-timeline: --intro; }\n    .toc a[href=\"#setup\"] { animation-timeline: --setup; }\n    .toc a[href=\"#usage\"] { animation-timeline: --usage; }\n\n    @keyframes spy {\n      0%, 100% { background: transparent; box-shadow: none; }\n      1%, 99%  { background: #dbeafe; box-shadow: inset 3px 0 0 #2563eb; }\n    }\n  }\n\u003C\u002Fstyle>\n\u003C\u002Fhead>\n\u003Cbody>\n  \u003Cdiv class=\"layout\">\n    \u003Cnav class=\"toc\" aria-label=\"On this page\">\n      \u003Ca href=\"#intro\">Introduction\u003C\u002Fa>\n      \u003Ca href=\"#setup\">Setup\u003C\u002Fa>\n      \u003Ca href=\"#usage\">Usage\u003C\u002Fa>\n    \u003C\u002Fnav>\n    \u003Cmain class=\"article\">\n      \u003Csection id=\"intro\">\u003Ch2>Introduction\u003C\u002Fh2>\u003Cp>…\u003C\u002Fp>\u003C\u002Fsection>\n      \u003Csection id=\"setup\">\u003Ch2>Setup\u003C\u002Fh2>\u003Cp>…\u003C\u002Fp>\u003C\u002Fsection>\n      \u003Csection id=\"usage\">\u003Ch2>Usage\u003C\u002Fh2>\u003Cp>…\u003C\u002Fp>\u003C\u002Fsection>\n    \u003C\u002Fmain>\n  \u003C\u002Fdiv>\n\u003C\u002Fbody>\n\u003C\u002Fhtml>\n","html","",[23,202,203,222,242,252,270,295,309,319,370,377,386,400,422,438,445,454,460,465,502,512,524,544,558,571,583,588,593,624,656,661,674,687,700,705,720,730,747,753,780,786,811,833,855,860,872,904,949,954,959,969,978,988,1007,1032,1054,1074,1094,1104,1120,1161,1197,1233,1242,1252,1261],{"__ignoreMap":200},[204,205,207,211,215,219],"span",{"class":154,"line":206},1,[204,208,210],{"class":209},"suds8","\u003C!",[204,212,214],{"class":213},"sne4z","doctype",[204,216,218],{"class":217},"s-5SL"," html",[204,220,221],{"class":209},">\n",[204,223,225,228,230,233,236,240],{"class":154,"line":224},2,[204,226,227],{"class":209},"\u003C",[204,229,199],{"class":213},[204,231,232],{"class":217}," lang",[204,234,235],{"class":209},"=",[204,237,239],{"class":238},"sT6z2","\"en\"",[204,241,221],{"class":209},[204,243,245,247,250],{"class":154,"line":244},3,[204,246,227],{"class":209},[204,248,249],{"class":213},"head",[204,251,221],{"class":209},[204,253,255,257,260,263,265,268],{"class":154,"line":254},4,[204,256,227],{"class":209},[204,258,259],{"class":213},"meta",[204,261,262],{"class":217}," charset",[204,264,235],{"class":209},[204,266,267],{"class":238},"\"utf-8\"",[204,269,221],{"class":209},[204,271,273,275,277,280,282,285,288,290,293],{"class":154,"line":272},5,[204,274,227],{"class":209},[204,276,259],{"class":213},[204,278,279],{"class":217}," name",[204,281,235],{"class":209},[204,283,284],{"class":238},"\"viewport\"",[204,286,287],{"class":217}," content",[204,289,235],{"class":209},[204,291,292],{"class":238},"\"width=device-width, initial-scale=1\"",[204,294,221],{"class":209},[204,296,298,300,302,305,307],{"class":154,"line":297},6,[204,299,227],{"class":209},[204,301,76],{"class":213},[204,303,304],{"class":209},">CSS-only scroll spy\u003C\u002F",[204,306,76],{"class":213},[204,308,221],{"class":209},[204,310,312,314,317],{"class":154,"line":311},7,[204,313,227],{"class":209},[204,315,316],{"class":213},"style",[204,318,221],{"class":209},[204,320,322,325,328,331,334,337,340,343,345,348,352,355,358,361,364,367],{"class":154,"line":321},8,[204,323,324],{"class":213},"  body",[204,326,327],{"class":209}," { ",[204,329,330],{"class":217},"margin",[204,332,333],{"class":209},": ",[204,335,336],{"class":217},"0",[204,338,339],{"class":209},"; ",[204,341,342],{"class":217},"font",[204,344,333],{"class":209},[204,346,347],{"class":217},"15",[204,349,351],{"class":350},"sHUrx","px",[204,353,354],{"class":209},"\u002F",[204,356,357],{"class":217},"1.6",[204,359,360],{"class":217}," system-ui",[204,362,363],{"class":209},", ",[204,365,366],{"class":217},"sans-serif",[204,368,369],{"class":209},"; }\n",[204,371,373],{"class":154,"line":372},9,[204,374,376],{"emptyLinePlaceholder":375},true,"\n",[204,378,380,383],{"class":154,"line":379},10,[204,381,382],{"class":217},"  .layout",[204,384,385],{"class":209}," {\n",[204,387,389,392,394,397],{"class":154,"line":388},11,[204,390,391],{"class":217},"    display",[204,393,333],{"class":209},[204,395,396],{"class":217},"grid",[204,398,399],{"class":209},";\n",[204,401,403,406,408,411,414,417,420],{"class":154,"line":402},12,[204,404,405],{"class":217},"    grid-template-columns",[204,407,333],{"class":209},[204,409,410],{"class":217},"10",[204,412,413],{"class":350},"rem",[204,415,416],{"class":217}," 1",[204,418,419],{"class":350},"fr",[204,421,399],{"class":209},[204,423,425,428,430,433,436],{"class":154,"line":424},13,[204,426,427],{"class":217},"    block-size",[204,429,333],{"class":209},[204,431,432],{"class":217},"100",[204,434,435],{"class":350},"vh",[204,437,399],{"class":209},[204,439,441],{"class":154,"line":440},14,[204,442,444],{"class":443},"sLBg1","    \u002F* Hoist the section timelines so the nav can use them. *\u002F\n",[204,446,448,451],{"class":154,"line":447},15,[204,449,450],{"class":217},"    timeline-scope",[204,452,453],{"class":209},": --intro, --setup, --usage;\n",[204,455,457],{"class":154,"line":456},16,[204,458,459],{"class":209},"  }\n",[204,461,463],{"class":154,"line":462},17,[204,464,376],{"emptyLinePlaceholder":375},[204,466,468,471,473,476,478,481,483,485,488,490,492,494,497,500],{"class":154,"line":467},18,[204,469,470],{"class":217},"  .toc",[204,472,327],{"class":209},[204,474,475],{"class":217},"padding",[204,477,333],{"class":209},[204,479,480],{"class":217},"1",[204,482,413],{"class":350},[204,484,339],{"class":209},[204,486,487],{"class":217},"border-inline-end",[204,489,333],{"class":209},[204,491,480],{"class":217},[204,493,351],{"class":350},[204,495,496],{"class":217}," solid",[204,498,499],{"class":217}," #cbd5e1",[204,501,369],{"class":209},[204,503,505,507,510],{"class":154,"line":504},19,[204,506,470],{"class":217},[204,508,509],{"class":213}," a",[204,511,385],{"class":209},[204,513,515,517,519,522],{"class":154,"line":514},20,[204,516,391],{"class":217},[204,518,333],{"class":209},[204,520,521],{"class":217},"block",[204,523,399],{"class":209},[204,525,527,530,532,535,537,540,542],{"class":154,"line":526},21,[204,528,529],{"class":217},"    padding",[204,531,333],{"class":209},[204,533,534],{"class":217},"0.25",[204,536,413],{"class":350},[204,538,539],{"class":217}," 0.5",[204,541,413],{"class":350},[204,543,399],{"class":209},[204,545,547,550,552,554,556],{"class":154,"line":546},22,[204,548,549],{"class":217},"    border-radius",[204,551,333],{"class":209},[204,553,172],{"class":217},[204,555,351],{"class":350},[204,557,399],{"class":209},[204,559,561,564,566,569],{"class":154,"line":560},23,[204,562,563],{"class":217},"    color",[204,565,333],{"class":209},[204,567,568],{"class":217},"inherit",[204,570,399],{"class":209},[204,572,574,577,579,581],{"class":154,"line":573},24,[204,575,576],{"class":217},"    text-decoration",[204,578,333],{"class":209},[204,580,117],{"class":217},[204,582,399],{"class":209},[204,584,586],{"class":154,"line":585},25,[204,587,459],{"class":209},[204,589,591],{"class":154,"line":590},26,[204,592,376],{"emptyLinePlaceholder":375},[204,594,596,599,601,604,606,609,611,613,615,617,620,622],{"class":154,"line":595},27,[204,597,598],{"class":217},"  .article",[204,600,327],{"class":209},[204,602,603],{"class":217},"overflow-y",[204,605,333],{"class":209},[204,607,608],{"class":217},"auto",[204,610,339],{"class":209},[204,612,475],{"class":217},[204,614,333],{"class":209},[204,616,336],{"class":217},[204,618,619],{"class":217}," 1.5",[204,621,413],{"class":350},[204,623,369],{"class":209},[204,625,627,629,632,634,637,639,641,643,645,648,650,652,654],{"class":154,"line":626},28,[204,628,598],{"class":217},[204,630,631],{"class":213}," section",[204,633,327],{"class":209},[204,635,636],{"class":217},"min-block-size",[204,638,333],{"class":209},[204,640,113],{"class":217},[204,642,435],{"class":350},[204,644,339],{"class":209},[204,646,647],{"class":217},"padding-block",[204,649,333],{"class":209},[204,651,480],{"class":217},[204,653,413],{"class":350},[204,655,369],{"class":209},[204,657,659],{"class":154,"line":658},29,[204,660,376],{"emptyLinePlaceholder":375},[204,662,664,667,669,671],{"class":154,"line":663},30,[204,665,666],{"class":217},"  #intro",[204,668,327],{"class":209},[204,670,48],{"class":217},[204,672,673],{"class":209},": --intro; }\n",[204,675,677,680,682,684],{"class":154,"line":676},31,[204,678,679],{"class":217},"  #setup",[204,681,327],{"class":209},[204,683,48],{"class":217},[204,685,686],{"class":209},": --setup; }\n",[204,688,690,693,695,697],{"class":154,"line":689},32,[204,691,692],{"class":217},"  #usage",[204,694,327],{"class":209},[204,696,48],{"class":217},[204,698,699],{"class":209},": --usage; }\n",[204,701,703],{"class":154,"line":702},33,[204,704,376],{"emptyLinePlaceholder":375},[204,706,708,711,714,717],{"class":154,"line":707},34,[204,709,710],{"class":350},"  @supports",[204,712,713],{"class":209}," (",[204,715,716],{"class":217},"animation-timeline",[204,718,719],{"class":209},": view()) {\n",[204,721,723,726,728],{"class":154,"line":722},35,[204,724,725],{"class":217},"    .toc",[204,727,509],{"class":213},[204,729,385],{"class":209},[204,731,733,736,739,742,745],{"class":154,"line":732},36,[204,734,735],{"class":217},"      animation",[204,737,738],{"class":209},": spy ",[204,740,741],{"class":217},"linear",[204,743,744],{"class":217}," both",[204,746,399],{"class":209},[204,748,750],{"class":154,"line":749},37,[204,751,752],{"class":443},"      \u002F* Highlight while the section occupies the middle of the scroller. *\u002F\n",[204,754,756,759,761,764,767,770,773,776,778],{"class":154,"line":755},38,[204,757,758],{"class":217},"      animation-range",[204,760,333],{"class":209},[204,762,763],{"class":217},"cover",[204,765,766],{"class":217}," 30",[204,768,769],{"class":350},"%",[204,771,772],{"class":217}," cover",[204,774,775],{"class":217}," 70",[204,777,769],{"class":350},[204,779,399],{"class":209},[204,781,783],{"class":154,"line":782},39,[204,784,785],{"class":209},"    }\n",[204,787,789,791,793,796,799,801,804,807,809],{"class":154,"line":788},40,[204,790,725],{"class":217},[204,792,509],{"class":213},[204,794,795],{"class":209},"[",[204,797,798],{"class":217},"href",[204,800,235],{"class":350},[204,802,803],{"class":238},"\"#intro\"",[204,805,806],{"class":209},"] { ",[204,808,716],{"class":217},[204,810,673],{"class":209},[204,812,814,816,818,820,822,824,827,829,831],{"class":154,"line":813},41,[204,815,725],{"class":217},[204,817,509],{"class":213},[204,819,795],{"class":209},[204,821,798],{"class":217},[204,823,235],{"class":350},[204,825,826],{"class":238},"\"#setup\"",[204,828,806],{"class":209},[204,830,716],{"class":217},[204,832,686],{"class":209},[204,834,836,838,840,842,844,846,849,851,853],{"class":154,"line":835},42,[204,837,725],{"class":217},[204,839,509],{"class":213},[204,841,795],{"class":209},[204,843,798],{"class":217},[204,845,235],{"class":350},[204,847,848],{"class":238},"\"#usage\"",[204,850,806],{"class":209},[204,852,716],{"class":217},[204,854,699],{"class":209},[204,856,858],{"class":154,"line":857},43,[204,859,376],{"emptyLinePlaceholder":375},[204,861,863,866,870],{"class":154,"line":862},44,[204,864,865],{"class":350},"    @keyframes",[204,867,869],{"class":868},"soyes"," spy",[204,871,385],{"class":209},[204,873,875,878,880,883,885,888,890,893,895,898,900,902],{"class":154,"line":874},45,[204,876,877],{"class":217},"      0%",[204,879,363],{"class":209},[204,881,882],{"class":217},"100%",[204,884,327],{"class":209},[204,886,887],{"class":217},"background",[204,889,333],{"class":209},[204,891,892],{"class":217},"transparent",[204,894,339],{"class":209},[204,896,897],{"class":217},"box-shadow",[204,899,333],{"class":209},[204,901,117],{"class":217},[204,903,369],{"class":209},[204,905,907,910,912,915,918,920,922,925,927,929,931,934,937,939,942,944,947],{"class":154,"line":906},46,[204,908,909],{"class":217},"      1%",[204,911,363],{"class":209},[204,913,914],{"class":217},"99%",[204,916,917],{"class":209},"  { ",[204,919,887],{"class":217},[204,921,333],{"class":209},[204,923,924],{"class":217},"#dbeafe",[204,926,339],{"class":209},[204,928,897],{"class":217},[204,930,333],{"class":209},[204,932,933],{"class":217},"inset",[204,935,936],{"class":217}," 3",[204,938,351],{"class":350},[204,940,941],{"class":217}," 0",[204,943,941],{"class":217},[204,945,946],{"class":217}," #2563eb",[204,948,369],{"class":209},[204,950,952],{"class":154,"line":951},47,[204,953,785],{"class":209},[204,955,957],{"class":154,"line":956},48,[204,958,459],{"class":209},[204,960,962,965,967],{"class":154,"line":961},49,[204,963,964],{"class":209},"\u003C\u002F",[204,966,316],{"class":213},[204,968,221],{"class":209},[204,970,972,974,976],{"class":154,"line":971},50,[204,973,964],{"class":209},[204,975,249],{"class":213},[204,977,221],{"class":209},[204,979,981,983,986],{"class":154,"line":980},51,[204,982,227],{"class":209},[204,984,985],{"class":213},"body",[204,987,221],{"class":209},[204,989,991,994,997,1000,1002,1005],{"class":154,"line":990},52,[204,992,993],{"class":209},"  \u003C",[204,995,996],{"class":213},"div",[204,998,999],{"class":217}," class",[204,1001,235],{"class":209},[204,1003,1004],{"class":238},"\"layout\"",[204,1006,221],{"class":209},[204,1008,1010,1013,1015,1017,1019,1022,1025,1027,1030],{"class":154,"line":1009},53,[204,1011,1012],{"class":209},"    \u003C",[204,1014,127],{"class":213},[204,1016,999],{"class":217},[204,1018,235],{"class":209},[204,1020,1021],{"class":238},"\"toc\"",[204,1023,1024],{"class":217}," aria-label",[204,1026,235],{"class":209},[204,1028,1029],{"class":238},"\"On this page\"",[204,1031,221],{"class":209},[204,1033,1035,1038,1040,1043,1045,1047,1050,1052],{"class":154,"line":1034},54,[204,1036,1037],{"class":209},"      \u003C",[204,1039,28],{"class":213},[204,1041,1042],{"class":217}," href",[204,1044,235],{"class":209},[204,1046,803],{"class":238},[204,1048,1049],{"class":209},">Introduction\u003C\u002F",[204,1051,28],{"class":213},[204,1053,221],{"class":209},[204,1055,1057,1059,1061,1063,1065,1067,1070,1072],{"class":154,"line":1056},55,[204,1058,1037],{"class":209},[204,1060,28],{"class":213},[204,1062,1042],{"class":217},[204,1064,235],{"class":209},[204,1066,826],{"class":238},[204,1068,1069],{"class":209},">Setup\u003C\u002F",[204,1071,28],{"class":213},[204,1073,221],{"class":209},[204,1075,1077,1079,1081,1083,1085,1087,1090,1092],{"class":154,"line":1076},56,[204,1078,1037],{"class":209},[204,1080,28],{"class":213},[204,1082,1042],{"class":217},[204,1084,235],{"class":209},[204,1086,848],{"class":238},[204,1088,1089],{"class":209},">Usage\u003C\u002F",[204,1091,28],{"class":213},[204,1093,221],{"class":209},[204,1095,1097,1100,1102],{"class":154,"line":1096},57,[204,1098,1099],{"class":209},"    \u003C\u002F",[204,1101,127],{"class":213},[204,1103,221],{"class":209},[204,1105,1107,1109,1111,1113,1115,1118],{"class":154,"line":1106},58,[204,1108,1012],{"class":209},[204,1110,131],{"class":213},[204,1112,999],{"class":217},[204,1114,235],{"class":209},[204,1116,1117],{"class":238},"\"article\"",[204,1119,221],{"class":209},[204,1121,1123,1125,1128,1131,1133,1136,1139,1141,1143,1145,1147,1149,1152,1154,1157,1159],{"class":154,"line":1122},59,[204,1124,1037],{"class":209},[204,1126,1127],{"class":213},"section",[204,1129,1130],{"class":217}," id",[204,1132,235],{"class":209},[204,1134,1135],{"class":238},"\"intro\"",[204,1137,1138],{"class":209},">\u003C",[204,1140,39],{"class":213},[204,1142,1049],{"class":209},[204,1144,39],{"class":213},[204,1146,1138],{"class":209},[204,1148,14],{"class":213},[204,1150,1151],{"class":209},">…\u003C\u002F",[204,1153,14],{"class":213},[204,1155,1156],{"class":209},">\u003C\u002F",[204,1158,1127],{"class":213},[204,1160,221],{"class":209},[204,1162,1164,1166,1168,1170,1172,1175,1177,1179,1181,1183,1185,1187,1189,1191,1193,1195],{"class":154,"line":1163},60,[204,1165,1037],{"class":209},[204,1167,1127],{"class":213},[204,1169,1130],{"class":217},[204,1171,235],{"class":209},[204,1173,1174],{"class":238},"\"setup\"",[204,1176,1138],{"class":209},[204,1178,39],{"class":213},[204,1180,1069],{"class":209},[204,1182,39],{"class":213},[204,1184,1138],{"class":209},[204,1186,14],{"class":213},[204,1188,1151],{"class":209},[204,1190,14],{"class":213},[204,1192,1156],{"class":209},[204,1194,1127],{"class":213},[204,1196,221],{"class":209},[204,1198,1200,1202,1204,1206,1208,1211,1213,1215,1217,1219,1221,1223,1225,1227,1229,1231],{"class":154,"line":1199},61,[204,1201,1037],{"class":209},[204,1203,1127],{"class":213},[204,1205,1130],{"class":217},[204,1207,235],{"class":209},[204,1209,1210],{"class":238},"\"usage\"",[204,1212,1138],{"class":209},[204,1214,39],{"class":213},[204,1216,1089],{"class":209},[204,1218,39],{"class":213},[204,1220,1138],{"class":209},[204,1222,14],{"class":213},[204,1224,1151],{"class":209},[204,1226,14],{"class":213},[204,1228,1156],{"class":209},[204,1230,1127],{"class":213},[204,1232,221],{"class":209},[204,1234,1236,1238,1240],{"class":154,"line":1235},62,[204,1237,1099],{"class":209},[204,1239,131],{"class":213},[204,1241,221],{"class":209},[204,1243,1245,1248,1250],{"class":154,"line":1244},63,[204,1246,1247],{"class":209},"  \u003C\u002F",[204,1249,996],{"class":213},[204,1251,221],{"class":209},[204,1253,1255,1257,1259],{"class":154,"line":1254},64,[204,1256,964],{"class":209},[204,1258,985],{"class":213},[204,1260,221],{"class":209},[204,1262,1264,1266,1268],{"class":154,"line":1263},65,[204,1265,964],{"class":209},[204,1267,199],{"class":213},[204,1269,221],{"class":209},[14,1271,1272,1273,1276,1277,1280],{},"The keyframes use a near-step pattern: transparent at the very ends, highlighted from 1% to 99%. Combined with the ",[23,1274,1275],{},"cover 30% cover 70%"," range, the link is highlighted while its section occupies the middle band of the scroller and plain otherwise. ",[23,1278,1279],{},"animation-fill-mode: both"," holds the transparent end states outside the range, so a link does not stay highlighted after its section scrolls away.",[39,1282,1284],{"id":1283},"the-key-technique-the-range-decides-which-link-is-active","The key technique: the range decides which link is active",[14,1286,1287,1288,1290,1291,1293],{},"A scroll spy should highlight one link at a time. With view timelines, each link runs independently, so \"one at a time\" comes from choosing ranges that do not overlap for adjacent sections. The ",[23,1289,1275],{}," range is active while the section's journey is between 30% and 70% — roughly while it crosses the middle of the scroller. Sections taller than the scroller make this easy; short sections can overlap, so give each section a ",[23,1292,636],{}," or narrow the range.",[67,1295,74,1298,74,1301,74,1304,74,1307,74,1312,74,1315,74,1318,74,1323,74,1326,74,1329,74,1335,74,1340,74,1345,74,1348],{"viewBox":1296,"role":70,"ariaLabel":1297,"xmlns":72,"style":73},"0 0 720 260","Three sections scrolling through a viewport; the middle band marks where each section's cover 30 to 70 percent range is active, so only one link lights at a time",[76,1299,1300],{},"Non-overlapping ranges give one active link",[80,1302,1303],{},"A horizontal axis of scroll position with three bars for the intro, setup and usage sections. Each bar has a highlighted middle portion for its active range from cover 30 to 70 percent. The highlighted portions follow one another without overlapping, so exactly one link is highlighted at any scroll position within the article.",[84,1305,1306],{"textAnchor":86,"x":87,"y":88,"style":89},"Active ranges tile the scroll",[92,1308],{"x":116,"y":1309,"width":156,"height":1310,"rx":172,"fill":118,"opacity":1311},"60","34","0.1",[92,1313],{"x":94,"y":1314,"width":156,"height":1310,"rx":172,"fill":118,"opacity":1311},"110",[92,1316],{"x":137,"y":1317,"width":156,"height":1310,"rx":172,"fill":118,"opacity":1311},"160",[92,1319],{"x":1320,"y":1309,"width":1321,"height":1310,"rx":173,"fill":99,"opacity":1322},"130","120","0.5",[92,1324],{"x":1325,"y":1314,"width":1321,"height":1310,"rx":173,"fill":99,"opacity":1322},"310",[92,1327],{"x":1328,"y":1317,"width":1321,"height":1310,"rx":173,"fill":99,"opacity":1322},"490",[84,1330,1334],{"textAnchor":86,"x":1331,"y":1332,"style":1333},"190","82","text-anchor:middle;fill:currentColor;font:600 12px sans-serif","intro active",[84,1336,1339],{"textAnchor":86,"x":1337,"y":1338,"style":1333},"370","132","setup active",[84,1341,1344],{"textAnchor":86,"x":1342,"y":1343,"style":1333},"550","182","usage active",[154,1346],{"x1":116,"y1":94,"x2":1347,"y2":94,"stroke":118,"strokeWidth":101,"opacity":158},"700",[84,1349,1350],{"textAnchor":86,"x":1337,"y":140,"style":181},"scroll position",[39,1352,1354],{"id":1353},"order-of-declarations-matters","Order of declarations matters",[14,1356,1357,1358,1361,1362,1364,1365,1367,1368,1371,1372,1374,1375,1377,1378,1381,1382,1384,1385,1388],{},"The ",[23,1359,1360],{},"animation"," shorthand resets ",[23,1363,716],{}," to ",[23,1366,608],{}," — a document timeline measured in time. In the implementation, the shorthand sits on ",[23,1369,1370],{},".toc a"," and each link's ",[23,1373,716],{}," sits in a separate, more specific rule, so the timeline survives. If both were written in the same rule, ",[23,1376,716],{}," would have to come ",[18,1379,1380],{},"after"," the shorthand; written before it, the shorthand silently overwrites it, and the animation, which has no duration of its own, completes instantly on page load and sits at its end state instead of following the scroll. DevTools shows the computed ",[23,1383,716],{}," value, which is the quickest way to confirm the problem. ",[23,1386,1387],{},"animation-range"," should likewise come after the shorthand. This ordering trap is the most common reason a scroll-driven animation \"does nothing\", and it is easy to miss because the declarations look correct in isolation.",[39,1390,1392],{"id":1391},"scroll-spy-for-horizontal-and-nested-layouts","Scroll spy for horizontal and nested layouts",[14,1394,1395,1396,1399,1400,1403,1404,1407,1408,1411,1412,1414,1415,1418,1419,1422],{},"Named timelines work on either axis. A horizontally scrolling set of slides can drive a row of dot indicators beneath it by declaring ",[23,1397,1398],{},"view-timeline: --slide-1 inline"," on each slide; the ",[23,1401,1402],{},"inline"," axis argument makes the timeline measure horizontal progress. Nested scrollers need care: a section's view timeline attaches to its ",[18,1405,1406],{},"nearest"," scroll container. If the article sits inside another scrolling panel, the timeline follows the inner scroller, which is usually what you want for a table of contents placed beside that panel. If the whole page scrolls instead, remove the inner ",[23,1409,1410],{},"overflow"," so the sections track the document scroller. When in doubt, check which ancestor has a computed ",[23,1413,1410],{}," other than ",[23,1416,1417],{},"visible"," or ",[23,1420,1421],{},"clip",".",[39,1424,1426],{"id":1425},"limits-styling-not-state","Limits: styling, not state",[14,1428,1429,1430,1433,1434,1437,1438,1441],{},"A CSS scroll spy changes appearance only. It cannot set ",[23,1431,1432],{},"aria-current=\"location\""," on the active link, so a screen reader user navigating the table of contents gets no indication of the current section. For many sites that is acceptable, because the highlight is a visual convenience and the headings themselves provide structure. When the current section matters — long documentation with deep navigation, for example — pair the CSS highlight with a small ",[23,1435,1436],{},"IntersectionObserver"," that sets ",[23,1439,1440],{},"aria-current",", and let the CSS keep doing the visual work without main-thread scroll handlers.",[14,1443,1444,1445,1447,1448,1450,1451,1454],{},"The other limit is that timeline names must be written out. ",[23,1446,25],{}," takes a comma-separated list of the names to hoist, and each link still needs its own ",[23,1449,716],{}," rule. For a table of contents generated by a static site generator, emitting these rules alongside the markup is straightforward; for hand-written pages with dozens of sections, it becomes tedious. Inline styles on each link, such as ",[23,1452,1453],{},"style=\"animation-timeline: --setup\"",", keep the rules next to the content they refer to.",[39,1456,1458],{"id":1457},"variation-a-progress-dot-per-chapter","Variation: a progress dot per chapter",[14,1460,1461],{},"The same wiring drives more than highlights. A rail of dots, one per chapter, can fill as each chapter is read:",[195,1463,1467],{"className":1464,"code":1465,"language":1466,"meta":200,"style":200},"language-css shiki shiki-themes github-light-high-contrast github-dark-high-contrast",".book { timeline-scope: --ch1, --ch2, --ch3; }   \u002F* ancestor of rail and chapters *\u002F\n#ch1 { view-timeline-name: --ch1; }\n#ch2 { view-timeline-name: --ch2; }\n#ch3 { view-timeline-name: --ch3; }\n\n.rail .dot::after {\n  content: \"\";\n  display: block;\n  aspect-ratio: 1;\n  border-radius: 50%;\n  background: #2563eb;\n  scale: 0;\n  animation: fill-dot linear both;\n  animation-range: contain;          \u002F* fill while the chapter covers the screen *\u002F\n}\n.rail .dot:nth-child(1)::after { animation-timeline: --ch1; }\n.rail .dot:nth-child(2)::after { animation-timeline: --ch2; }\n.rail .dot:nth-child(3)::after { animation-timeline: --ch3; }\n\n@keyframes fill-dot { to { scale: 1; } }\n","css",[23,1468,1469,1484,1496,1508,1520,1524,1534,1546,1557,1568,1581,1593,1604,1618,1634,1639,1663,1683,1704,1708],{"__ignoreMap":200},[204,1470,1471,1474,1476,1478,1481],{"class":154,"line":206},[204,1472,1473],{"class":217},".book",[204,1475,327],{"class":209},[204,1477,25],{"class":217},[204,1479,1480],{"class":209},": --ch1, --ch2, --ch3; }   ",[204,1482,1483],{"class":443},"\u002F* ancestor of rail and chapters *\u002F\n",[204,1485,1486,1489,1491,1493],{"class":154,"line":224},[204,1487,1488],{"class":217},"#ch1",[204,1490,327],{"class":209},[204,1492,48],{"class":217},[204,1494,1495],{"class":209},": --ch1; }\n",[204,1497,1498,1501,1503,1505],{"class":154,"line":244},[204,1499,1500],{"class":217},"#ch2",[204,1502,327],{"class":209},[204,1504,48],{"class":217},[204,1506,1507],{"class":209},": --ch2; }\n",[204,1509,1510,1513,1515,1517],{"class":154,"line":254},[204,1511,1512],{"class":217},"#ch3",[204,1514,327],{"class":209},[204,1516,48],{"class":217},[204,1518,1519],{"class":209},": --ch3; }\n",[204,1521,1522],{"class":154,"line":272},[204,1523,376],{"emptyLinePlaceholder":375},[204,1525,1526,1529,1532],{"class":154,"line":297},[204,1527,1528],{"class":217},".rail",[204,1530,1531],{"class":217}," .dot::after",[204,1533,385],{"class":209},[204,1535,1536,1539,1541,1544],{"class":154,"line":311},[204,1537,1538],{"class":217},"  content",[204,1540,333],{"class":209},[204,1542,1543],{"class":238},"\"\"",[204,1545,399],{"class":209},[204,1547,1548,1551,1553,1555],{"class":154,"line":321},[204,1549,1550],{"class":217},"  display",[204,1552,333],{"class":209},[204,1554,521],{"class":217},[204,1556,399],{"class":209},[204,1558,1559,1562,1564,1566],{"class":154,"line":372},[204,1560,1561],{"class":217},"  aspect-ratio",[204,1563,333],{"class":209},[204,1565,480],{"class":217},[204,1567,399],{"class":209},[204,1569,1570,1573,1575,1577,1579],{"class":154,"line":379},[204,1571,1572],{"class":217},"  border-radius",[204,1574,333],{"class":209},[204,1576,97],{"class":217},[204,1578,769],{"class":350},[204,1580,399],{"class":209},[204,1582,1583,1586,1588,1591],{"class":154,"line":388},[204,1584,1585],{"class":217},"  background",[204,1587,333],{"class":209},[204,1589,1590],{"class":217},"#2563eb",[204,1592,399],{"class":209},[204,1594,1595,1598,1600,1602],{"class":154,"line":402},[204,1596,1597],{"class":217},"  scale",[204,1599,333],{"class":209},[204,1601,336],{"class":217},[204,1603,399],{"class":209},[204,1605,1606,1609,1612,1614,1616],{"class":154,"line":424},[204,1607,1608],{"class":217},"  animation",[204,1610,1611],{"class":209},": fill-dot ",[204,1613,741],{"class":217},[204,1615,744],{"class":217},[204,1617,399],{"class":209},[204,1619,1620,1623,1625,1628,1631],{"class":154,"line":440},[204,1621,1622],{"class":217},"  animation-range",[204,1624,333],{"class":209},[204,1626,1627],{"class":217},"contain",[204,1629,1630],{"class":209},";          ",[204,1632,1633],{"class":443},"\u002F* fill while the chapter covers the screen *\u002F\n",[204,1635,1636],{"class":154,"line":447},[204,1637,1638],{"class":209},"}\n",[204,1640,1641,1643,1646,1649,1651,1654,1657,1659,1661],{"class":154,"line":456},[204,1642,1528],{"class":217},[204,1644,1645],{"class":217}," .dot:nth-child",[204,1647,1648],{"class":209},"(",[204,1650,480],{"class":217},[204,1652,1653],{"class":209},")",[204,1655,1656],{"class":217},"::after",[204,1658,327],{"class":209},[204,1660,716],{"class":217},[204,1662,1495],{"class":209},[204,1664,1665,1667,1669,1671,1673,1675,1677,1679,1681],{"class":154,"line":462},[204,1666,1528],{"class":217},[204,1668,1645],{"class":217},[204,1670,1648],{"class":209},[204,1672,170],{"class":217},[204,1674,1653],{"class":209},[204,1676,1656],{"class":217},[204,1678,327],{"class":209},[204,1680,716],{"class":217},[204,1682,1507],{"class":209},[204,1684,1685,1687,1689,1691,1694,1696,1698,1700,1702],{"class":154,"line":467},[204,1686,1528],{"class":217},[204,1688,1645],{"class":217},[204,1690,1648],{"class":209},[204,1692,1693],{"class":217},"3",[204,1695,1653],{"class":209},[204,1697,1656],{"class":217},[204,1699,327],{"class":209},[204,1701,716],{"class":217},[204,1703,1519],{"class":209},[204,1705,1706],{"class":154,"line":504},[204,1707,376],{"emptyLinePlaceholder":375},[204,1709,1710,1713,1716,1718,1721,1723,1726,1728,1730],{"class":154,"line":514},[204,1711,1712],{"class":350},"@keyframes",[204,1714,1715],{"class":868}," fill-dot",[204,1717,327],{"class":209},[204,1719,1720],{"class":217},"to",[204,1722,327],{"class":209},[204,1724,1725],{"class":217},"scale",[204,1727,333],{"class":209},[204,1729,480],{"class":217},[204,1731,1732],{"class":209},"; } }\n",[14,1734,1735,1736,1738,1739,1741,1742,1745],{},"Here each dot's inner fill scales from zero to full across the ",[23,1737,1627],{}," range of its chapter, so a half-read chapter shows a half-filled dot. The chapters must be taller than the scroller for ",[23,1740,1627],{}," to mean \"covering the screen\"; for short chapters, ",[23,1743,1744],{},"cover 25% cover 75%"," behaves more predictably. As always with scroll-linked motion, a reduced-motion preference is best honoured by switching to a static indicator.",[39,1747,1749],{"id":1748},"browser-support","Browser support",[14,1751,1752,1754,1755,1757,1758,1760,1761,1764],{},[23,1753,25],{}," is supported in Chrome and Edge 116+ and Safari 26+. ",[23,1756,716],{}," and ",[23,1759,1387],{}," are supported in Chrome and Edge 115+ and Safari 26+. In Firefox, scroll-driven animations are available only as a preview behind a flag, not in stable releases, so the ",[23,1762,1763],{},"@supports (animation-timeline: view())"," wrapper leaves the navigation as a plain list of links there. Nothing breaks; the highlight is simply absent.",[39,1766,1768],{"id":1767},"faq","FAQ",[14,1770,1771,1775],{},[1772,1773,1774],"strong",{},"What does timeline-scope do?","\nIt hoists a named scroll or view timeline up to an ancestor, so any descendant of that ancestor can use it. Without it, a named timeline is only visible to the element that declares it and its descendants.",[14,1777,1778,1781,1782,1784,1785,1787,1788,1790],{},[1772,1779,1780],{},"Can a sibling element animate from another element's scroll position?","\nYes, with ",[23,1783,25],{},". Declare the timeline name on the common ancestor with ",[23,1786,25],{},", name the timeline on the tracked element, and reference the name with ",[23,1789,716],{}," on the sibling.",[14,1792,1793,1796,1797,1799],{},[1772,1794,1795],{},"Why is my named timeline not found?","\nThe animating element must be a descendant of either the element that defines the timeline or an ancestor that lists it in ",[23,1798,25],{},". If it is neither, the name resolves to nothing and the animation has no timeline, so it does not run.",[14,1801,1802,1805,1806,1808],{},[1772,1803,1804],{},"Can this replace IntersectionObserver for a scroll spy?","\nFor the visual highlight, yes, in browsers that support scroll-driven animations. It cannot update ",[23,1807,1440],{}," or other attributes, so if assistive technology needs to know the current section, a small script is still required.",[39,1810,1812],{"id":1811},"related","Related",[1814,1815,1816,1822,1829,1836],"ul",{},[1817,1818,1819,1821],"li",{},[28,1820,31],{"href":30}," — the parent guide.",[1817,1823,1824,1828],{},[28,1825,1827],{"href":1826},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fview-timeline-and-animation-range\u002F","View Timelines and animation-range"," — the ranges used here.",[1817,1830,1831,1835],{},[28,1832,1834],{"href":1833},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fscroll-progress-bar-without-javascript\u002F","Scroll Progress Bar Without JavaScript"," — a page-level scroll timeline.",[1817,1837,1838,1842],{},[28,1839,1841],{"href":1840},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fscroll-driven-animation-fallbacks\u002F","Scroll-Driven Animation Fallbacks"," — static alternatives for other browsers.",[316,1844,1845],{},"html pre.shiki code .suds8, html code.shiki .suds8{--shiki-default:#0E1116;--shiki-dark:#F0F3F6}html pre.shiki code .sne4z, html code.shiki .sne4z{--shiki-default:#024C1A;--shiki-dark:#72F088}html pre.shiki code .s-5SL, html code.shiki .s-5SL{--shiki-default:#023B95;--shiki-dark:#91CBFF}html pre.shiki code .sT6z2, html code.shiki .sT6z2{--shiki-default:#032563;--shiki-dark:#ADDCFF}html pre.shiki code .sHUrx, html code.shiki .sHUrx{--shiki-default:#A0111F;--shiki-dark:#FF9492}html pre.shiki code .sLBg1, html code.shiki .sLBg1{--shiki-default:#66707B;--shiki-dark:#BDC4CC}html pre.shiki code .soyes, html code.shiki .soyes{--shiki-default:#702C00;--shiki-dark:#FFB757}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":200,"searchDepth":224,"depth":224,"links":1847},[1848,1849,1850,1851,1852,1853,1854,1855,1856,1857],{"id":41,"depth":224,"text":42},{"id":185,"depth":224,"text":186},{"id":1283,"depth":224,"text":1284},{"id":1353,"depth":224,"text":1354},{"id":1391,"depth":224,"text":1392},{"id":1425,"depth":224,"text":1426},{"id":1457,"depth":224,"text":1458},{"id":1748,"depth":224,"text":1749},{"id":1767,"depth":224,"text":1768},{"id":1811,"depth":224,"text":1812},"Drive one element’s animation from another element’s scroll position with named timelines and timeline-scope: a table of contents tracking the section in view.","md",{"pageTitle":5,"datePublished":1861,"dateModified":1861,"faq":1862},"2026-09-18",[1863,1865,1867,1869],{"q":1774,"a":1864},"It hoists a named scroll or view timeline up to an ancestor, so any descendant of that ancestor can use it. Without it, a named timeline is only visible to the element that declares it and its descendants.",{"q":1780,"a":1866},"Yes, with timeline-scope. Declare the timeline name on the common ancestor with timeline-scope, name the timeline on the tracked element, and reference the name with animation-timeline on the sibling.",{"q":1795,"a":1868},"The animating element must be a descendant of either the element that defines the timeline or an ancestor that lists it in timeline-scope. If it is neither, the name resolves to nothing and the animation has no timeline, so it does not run.",{"q":1804,"a":1870},"For the visual highlight, yes, in browsers that support scroll-driven animations. It cannot update aria-current or other attributes, so if assistive technology needs to know the current section, a small script is still required.","\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Ftimeline-scope-for-cross-element-animations",{"title":5,"description":1858},"css-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Ftimeline-scope-for-cross-element-animations\u002Findex","GMpiYbDR95EyibYpzKn8Z1gqspAIoRSZNXI4FxRT0W4",[1876,1879,1882,1885,1888,1891,1894,1897,1900,1903,1906,1909,1912,1915,1918,1921,1924,1927,1930,1933,1936,1939,1942,1945,1948,1951,1954,1957,1960,1963,1966,1969,1972,1975,1978,1981,1984,1987,1990,1993,1996,1999,2002,2005,2008,2011,2014,2017,2020,2023,2026,2029,2032,2035,2038,2041,2044,2047,2050,2053,2056,2059,2062,2065,2068,2071,2074,2077,2080,2083,2086,2089,2092,2095,2098,2101,2104,2107,2110,2113,2116,2119,2122,2125,2128,2129,2131,2134,2137,2140,2143,2146,2149,2152,2154,2157,2160,2163,2166,2169,2172,2175,2178,2181,2184,2187,2190,2193,2196,2199,2202,2205,2208,2211,2214,2217,2220,2223,2226,2229,2232,2235,2238,2241,2244,2247,2250,2253,2256,2259,2262,2265,2268,2271,2274,2277,2280,2283,2286,2289,2292,2295,2298,2301,2304,2307,2310,2313,2316,2319,2322,2325,2328,2331,2334,2337,2340,2343,2346,2349,2352,2355,2358,2361,2364,2367,2370,2373,2376,2379,2382,2385,2388,2391,2394,2397,2400,2403,2406,2409,2412,2415,2418,2421,2424,2427,2430],{"path":1877,"title":1878},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fcreating-accessible-focus-indicators","Creating Accessible Focus Indicators: Building a Ring That Survives Any Background",{"path":1880,"title":1881},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fflashing-content-and-seizure-thresholds","Flashing Content and Seizure Thresholds",{"path":1883,"title":1884},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fforced-colors-mode-and-animations","Forced Colors Mode and Animations",{"path":1886,"title":1887},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations","Accessibility in CSS Animations: Patterns, Specs & Best Practices",{"path":1889,"title":1890},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fpause-controls-for-looping-animations","Pause Controls for Looping CSS Animations: Meeting WCAG 2.2.2",{"path":1892,"title":1893},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fprefers-reduced-motion-recipes","prefers-reduced-motion Recipes: A Reduction for Every Common Effect",{"path":1895,"title":1896},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Freducing-motion-preferences-in-css","Reducing Motion Preferences in CSS: How the Setting Becomes a Media Feature",{"path":1898,"title":1899},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Ftarget-size-and-pointer-accessibility","Target Size and Pointer Accessibility: Meeting 2.5.8 Without Redesigning",{"path":1901,"title":1902},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fvestibular-safe-animation-patterns","Vestibular-Safe Animation Patterns: Why Some Motion Makes People Sick",{"path":1904,"title":1905},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fwcag-motion-success-criteria","WCAG Motion Success Criteria: What Each One Actually Requires",{"path":1907,"title":1908},"\u002Fcss-only-micro-interactions-animations\u002Fclip-path-and-mask-animations\u002Fanimated-gradient-borders-with-property","Animated Gradient Borders With @property: A Spinning Highlight Without Extra Elements",{"path":1910,"title":1911},"\u002Fcss-only-micro-interactions-animations\u002Fclip-path-and-mask-animations\u002Fclip-path-reveal-animations","Clip-Path Reveal Animations: Wipes, Irises and Corners Without Extra Markup",{"path":1913,"title":1914},"\u002Fcss-only-micro-interactions-animations\u002Fclip-path-and-mask-animations","Clip-Path & Mask Animations: Animating Visibility Instead of Position",{"path":1916,"title":1917},"\u002Fcss-only-micro-interactions-animations\u002Fclip-path-and-mask-animations\u002Fmask-image-fade-edges","Fading Edges With mask-image: Soft Boundaries That Work on Any Background",{"path":1919,"title":1920},"\u002Fcss-only-micro-interactions-animations\u002Fclip-path-and-mask-animations\u002Fmorphing-shapes-with-clip-path-polygon","Morphing Shapes With clip-path: polygon(): Point-Matched Transitions",{"path":1922,"title":1923},"\u002Fcss-only-micro-interactions-animations\u002Fcolor-and-theme-transitions\u002Fanimating-gradients","Animating CSS Gradients: Smooth Colour Motion Without Jumps",{"path":1925,"title":1926},"\u002Fcss-only-micro-interactions-animations\u002Fcolor-and-theme-transitions\u002Fcolor-mix-hover-states","Hover and Active States With color-mix(): One Token, Every Shade",{"path":1928,"title":1929},"\u002Fcss-only-micro-interactions-animations\u002Fcolor-and-theme-transitions","Color & Theme Transitions: Colour as Part of the Motion System",{"path":1931,"title":1932},"\u002Fcss-only-micro-interactions-animations\u002Fcolor-and-theme-transitions\u002Flight-dark-function-for-themes","Light and Dark Themes With light-dark(): One Declaration per Colour",{"path":1934,"title":1935},"\u002Fcss-only-micro-interactions-animations\u002Fcolor-and-theme-transitions\u002Fsmooth-theme-switching-transitions","Smooth Theme Switching: Crossfades, Circular Reveals and No Flash",{"path":1937,"title":1938},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion\u002Fcontainer-query-hover-affordances","Container Query Hover Affordances: When Narrow Means Persistent, Not Hidden",{"path":1940,"title":1941},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion","Container-Aware Motion: Animation Sized by the Space a Component Actually Has",{"path":1943,"title":1944},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion\u002Flayout-change-animations-at-container-breakpoints","Animating Changes at Container Breakpoints",{"path":1946,"title":1947},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion\u002Fmotion-driven-by-container-style-queries","Motion Driven by Container Style Queries",{"path":1949,"title":1950},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion\u002Fmotion-that-scales-with-container-size","Motion That Scales with Container Size: cqi, cqb, and Derived Durations",{"path":1952,"title":1953},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion\u002Fsuppressing-motion-in-small-containers","Suppressing Motion in Small Containers: Deliberately Animating Nothing",{"path":1955,"title":1956},"\u002Fcss-only-micro-interactions-animations\u002Fcss-animation-vs-web-animations-api\u002Fcontrolling-css-animations-from-javascript","Controlling CSS Animations From JavaScript",{"path":1958,"title":1959},"\u002Fcss-only-micro-interactions-animations\u002Fcss-animation-vs-web-animations-api","CSS Animation vs the Web Animations API: A Decision Guide",{"path":1961,"title":1962},"\u002Fcss-only-micro-interactions-animations\u002Fcss-animation-vs-web-animations-api\u002Fwaapi-vs-css-for-interruptible-ui","Interruptible UI: CSS Transitions vs WAAPI",{"path":1964,"title":1965},"\u002Fcss-only-micro-interactions-animations\u002Fcss-animation-vs-web-animations-api\u002Fwhen-to-use-javascript-animation","When to Use JavaScript Instead of CSS for Animation",{"path":1967,"title":1968},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture\u002Fanimating-custom-properties-with-at-property","Animating Custom Properties with @property: Typed Variables That Interpolate",{"path":1970,"title":1971},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture\u002Fcustom-property-fallbacks-and-invalid-values","Custom Property Fallbacks and Invalid Values",{"path":1973,"title":1974},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture\u002Ffluid-spacing-tokens-driving-transition-durations","Fluid Spacing Tokens That Drive Transition Durations",{"path":1976,"title":1977},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture","CSS Custom Properties Architecture: Scalable Design Systems & Dynamic UI",{"path":1979,"title":1980},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture\u002Fregistered-properties-and-type-safety","Registered Properties and Type Safety: @property as a Contract for Design Tokens",{"path":1982,"title":1983},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture\u002Fscoping-custom-properties-to-components","Scoping Custom Properties to Components",{"path":1985,"title":1986},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Fcss-transition-timing-functions","CSS Transition Timing Functions: ease, cubic-bezier(), steps() and linear()",{"path":1988,"title":1989},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals","CSS Transition Fundamentals: Architecture, Performance & Patterns",{"path":1991,"title":1992},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Finterrupted-and-reversing-transitions","Interrupted and Reversing Transitions: What Happens Mid-Flight",{"path":1994,"title":1995},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Fstarting-style-entry-animations","@starting-style: Animating an Element's Very First Style Change",{"path":1997,"title":1998},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Ftransition-delay-choreography","Choreographing Motion With transition-delay",{"path":2000,"title":2001},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Ftransition-shorthand-and-multiple-properties","The transition Shorthand and Multiple Properties",{"path":2003,"title":2004},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Ftransitioning-display-with-allow-discrete","Transitioning display with transition-behavior: allow-discrete and @starting-style",{"path":2006,"title":2007},"\u002Fcss-only-micro-interactions-animations\u002Fdialog-and-popover-animations\u002Fanimating-dialog-open-and-close","Animating \u003Cdialog> Open and Close: Both Directions, No Library",{"path":2009,"title":2010},"\u002Fcss-only-micro-interactions-animations\u002Fdialog-and-popover-animations\u002Fbackdrop-animations","Animating ::backdrop: Fades and Blurs Behind Dialogs and Popovers",{"path":2012,"title":2013},"\u002Fcss-only-micro-interactions-animations\u002Fdialog-and-popover-animations","Dialog & Popover Animations: Motion for the Top Layer",{"path":2015,"title":2016},"\u002Fcss-only-micro-interactions-animations\u002Fdialog-and-popover-animations\u002Finterpolate-size-for-height-auto-animation","Animating to height: auto With interpolate-size and calc-size()",{"path":2018,"title":2019},"\u002Fcss-only-micro-interactions-animations\u002Fdialog-and-popover-animations\u002Fpopover-entry-and-exit-transitions","Popover Menus That Animate From Their Anchor",{"path":2021,"title":2022},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design\u002Fchoosing-animation-durations","Choosing Animation Durations: How Long Motion Should Last",{"path":2024,"title":2025},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design\u002Fcubic-bezier-overshoot-and-anticipation","Overshoot and Anticipation With cubic-bezier(): Motion With Character",{"path":2027,"title":2028},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design\u002Fentry-vs-exit-easing","Entry vs Exit Easing: Different Curves for Arriving and Leaving",{"path":2030,"title":2031},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design","Easing & Motion Design: Making CSS Motion Feel Intentional",{"path":2033,"title":2034},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design\u002Flinear-easing-function-for-springs","Spring and Bounce Easing With linear(): Physical Motion Without JavaScript",{"path":2036,"title":2037},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design\u002Fsteps-easing-for-sprite-animations","steps() Easing: Sprite Sheets, Typewriters and Other Frame-by-Frame Effects",{"path":2039,"title":2040},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design\u002Faccessible-css-only-tooltips","Accessible CSS-Only Tooltips and Hover Cards With  and ",{"path":2042,"title":2043},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design\u002Fbutton-press-and-active-states","Button Press and  States",{"path":2045,"title":2046},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design\u002Ffocus-visible-vs-focus-polyfill-alternatives"," vs :focus: Why It Replaced the Focus-Ring Polyfill",{"path":2048,"title":2049},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design\u002Ffocus-within-form-patterns"," Form Patterns: Styling a Group From the Field Inside It",{"path":2051,"title":2052},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design\u002Fhover-intent-delays-with-transition-delay","Hover Intent Delays With transition-delay: Menus That Don't Flicker",{"path":2054,"title":2055},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design","Hover & Focus State Design: Spec-Compliant Patterns for Modern UIs",{"path":2057,"title":2058},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design\u002Fpointer-and-hover-media-queries","Pointer and Hover Media Queries: Gating Affordances by Input Capability",{"path":2060,"title":2061},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design\u002Fsmooth-hover-effects-without-javascript","Smooth Hover Effects Without JavaScript: CSS-Only Patterns for Modern UI",{"path":2063,"title":2064},"\u002Fcss-only-micro-interactions-animations","CSS-Only Micro-Interactions & Animations: Architecture, Performance & Implementation",{"path":2066,"title":2067},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fanimation-composition-and-stacking","Stacking Animations With animation-composition",{"path":2069,"title":2070},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fanimation-fill-mode-explained","animation-fill-mode: What an Animation Applies Before and After It Runs",{"path":2072,"title":2073},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fcontainer-query-triggered-keyframe-animations","Container-Query-Triggered Keyframe Animations: Animate Differently per Available Space",{"path":2075,"title":2076},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fcss-only-accordions-and-disclosure","CSS-Only Accordions and Disclosure Widgets with details and summary",{"path":2078,"title":2079},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fcss-only-loading-spinners-and-skeletons","CSS-Only Loading Spinners and Skeleton Shimmer Screens with @keyframes",{"path":2081,"title":2082},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fcss-only-toggle-switches-and-checkboxes","CSS-Only Toggle Switches and Checkboxes That Keep the Native Input",{"path":2084,"title":2085},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns","Keyframe Animation Patterns: Spec-Compliant Architectures for Modern UIs",{"path":2087,"title":2088},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fmulti-step-keyframes-and-per-keyframe-easing","Multi-Step Keyframes and Per-Keyframe Easing",{"path":2090,"title":2091},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fstaggered-list-animations-with-custom-properties","Staggered List Animations Using --i Index Custom Properties",{"path":2093,"title":2094},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Fanimating-box-shadow-and-filters-cheaply","Animating box-shadow and Filters Cheaply",{"path":2096,"title":2097},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Fcontain-property-for-animation-performance","The contain Property for Animation Performance",{"path":2099,"title":2100},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Fcss-triggers-layout-paint-composite","Layout, Paint and Composite: What Triggers What",{"path":2102,"title":2103},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration","Performance & GPU Acceleration in CSS: A Developer’s Blueprint",{"path":2105,"title":2106},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Foptimizing-css-animations-for-60fps","Optimizing CSS Animations for 60fps: Budgeting the Frame",{"path":2108,"title":2109},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Fprofiling-animations-in-devtools","Profiling CSS Animations in DevTools: Finding the Frame That Costs Too Much",{"path":2111,"title":2112},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Fwill-change-and-the-compositor-thread","will-change and the Compositor Thread: Layer Promotion Without the Footguns",{"path":2114,"title":2115},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations","Scroll-Driven Animations: Binding Motion to Scroll Position in Pure CSS",{"path":2117,"title":2118},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fscroll-driven-animation-fallbacks","Shipping Scroll-Driven Animations Without Breaking Anything",{"path":2120,"title":2121},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fscroll-driven-parallax-effects","Scroll-Driven Parallax Effects in CSS",{"path":2123,"title":2124},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fscroll-progress-bar-without-javascript","A Reading Progress Bar Driven by scroll(root)",{"path":2126,"title":2127},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fscroll-triggered-reveal-animations","Reveal-on-Scroll with view() and animation-range",{"path":1871,"title":5},{"path":2130,"title":1827},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fview-timeline-and-animation-range",{"path":2132,"title":2133},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fcross-document-view-transitions","Cross-Document View Transitions",{"path":2135,"title":2136},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers","View Transitions for CSS Developers: the Pseudo-Element Tree, Snapshots, and Named Elements",{"path":2138,"title":2139},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fsame-document-view-transitions","Writing a Same-Document View Transition: the CSS You Actually Author",{"path":2141,"title":2142},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fview-transition-names-shared-elements","view-transition-name and Shared Elements: Morphing a Thumbnail into a Hero",{"path":2144,"title":2145},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fview-transition-types-and-classes","View Transition Types and Classes",{"path":2147,"title":2148},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fview-transitions-for-list-reordering","View Transitions for List Reordering",{"path":2150,"title":2151},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fview-transitions-with-reduced-motion","Honouring prefers-reduced-motion in View Transitions",{"path":354,"title":2153},"Modern CSS Layouts & Micro-Interactions",{"path":2155,"title":2156},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fanchor-positioned-tooltips","Anchor-Positioned Tooltips: Tethering, Flipping, and Getting the Semantics Right",{"path":2158,"title":2159},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fanchor-positioning-fallbacks","Anchor Positioning Fallbacks: A Graceful Floor for Older Browser Versions",{"path":2161,"title":2162},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fanchor-size-for-matching-widths","anchor-size(): Overlays That Match Their Trigger's Size",{"path":2164,"title":2165},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays","CSS Anchor Positioning and Overlays: Tethering Elements Without JavaScript",{"path":2167,"title":2168},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fpopover-attribute-and-css-styling","The popover Attribute: Top-Layer Overlays With No JavaScript",{"path":2170,"title":2171},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fpopover-light-dismiss-and-stacking","Popover Light Dismiss, Nesting and Stacking",{"path":2173,"title":2174},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fposition-area-grid-explained","position-area: The Anchor Placement Grid",{"path":2176,"title":2177},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Fcontainer-query-polyfill-tradeoffs","Container Query Polyfills: What They Cost and When to Skip Them",{"path":2179,"title":2180},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Ffeature-detection-with-supports","Feature Detection with @supports: Syntax, Semantics, and the Traps",{"path":2182,"title":2183},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Fhandling-container-query-fallbacks-for-older-browsers","Handling Container Query Fallbacks for Older Browsers",{"path":2185,"title":2186},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks","Container Query Fallbacks: Spec-Compliant CSS Strategies for Legacy Browsers",{"path":2188,"title":2189},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Fintrinsic-layout-fallbacks-without-queries","Intrinsic Layout Fallbacks: Baselines That Adapt Without Any Query",{"path":2191,"title":2192},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Ftesting-fallbacks-without-old-browsers","Testing CSS Fallbacks Without an Old Browser",{"path":2194,"title":2195},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fcontainer-queries-inside-css-nesting","Container Queries Inside CSS Nesting: Keeping Responses Next to the Styles They Change",{"path":2197,"title":2198},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fcontainer-query-range-and-logic-operators","Container Query Range Syntax and Logic Operators",{"path":2200,"title":2201},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fcontainer-query-units-cqi-cqb-explained","Container Query Units Explained: cqi, cqb, cqw, cqh, cqmin and cqmax",{"path":2203,"title":2204},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fcontainer-type-size-vs-inline-size","Choosing container-type: inline-size, size, or normal",{"path":2206,"title":2207},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fcontainer-vs-media-queries-comparison","Container vs Media Queries: Choosing the Right Reference Box",{"path":2209,"title":2210},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fdebugging-container-queries-in-devtools","Debugging Container Queries in DevTools: Why a Rule Doesn't Match",{"path":2212,"title":2213},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fhow-to-use-container-queries-in-production","How to Use Container Queries in Production Without a Rewrite",{"path":2215,"title":2216},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics","Container Query Syntax Basics",{"path":2218,"title":2219},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fnesting-and-naming-container-queries","Nesting and Naming Container Queries: Targeting the Right Ancestor",{"path":2221,"title":2222},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fauto-fit-minmax-responsive-grids","Responsive Grids with repeat(auto-fit, minmax())",{"path":2224,"title":2225},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fbuilding-a-dashboard-with-subgrid","Building a Responsive Dashboard Where Cards Align with Subgrid",{"path":2227,"title":2228},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fgrid-auto-flow-dense-packing","grid-auto-flow: dense for Packed Layouts",{"path":2230,"title":2231},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fgrid-template-areas-responsive-layouts","Responsive Layouts With grid-template-areas: Rearranging Regions by Name",{"path":2233,"title":2234},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fholy-grail-layout-with-grid","The Holy-Grail Layout with CSS Grid and Container Queries",{"path":2236,"title":2237},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts","CSS Grid and Subgrid Layouts for Responsive Interfaces",{"path":2239,"title":2240},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fmasonry-style-layouts-with-grid","Masonry-Style Layouts With the CSS That Ships Today",{"path":2242,"title":2243},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Foverlapping-elements-with-grid-stacking","Overlapping Elements With Grid Stacking: Layers Without position: absolute",{"path":2245,"title":2246},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fsubgrid-vs-nested-grid","Subgrid vs an Independently Nested Grid",{"path":2248,"title":2249},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fcentering-in-css-every-method","Centering in CSS: Every Modern Method and When Each One Breaks",{"path":2251,"title":2252},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fflex-basis-vs-width","flex-basis vs width: Which Size a Flex Item Actually Starts From",{"path":2254,"title":2255},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fflex-grow-and-flex-shrink-explained","flex-grow and flex-shrink Explained",{"path":2257,"title":2258},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fflex-wrap-intrinsic-responsive-rows","Breakpoint-Free Responsive Rows With flex-wrap and flex-basis",{"path":2260,"title":2261},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fflexbox-gap-and-spacing","Flexbox gap vs Margins: Spacing Items Without Edge Hacks",{"path":2263,"title":2264},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns","Flexbox Layout Patterns: One-Dimensional Layout for Real Components",{"path":2266,"title":2267},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fsticky-footer-with-flexbox-and-grid","Sticky Footer With Flexbox or Grid: Pinning the Footer on Short Pages",{"path":2269,"title":2270},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp\u002Fclamp-vs-media-query-typography","clamp() Fluid Type vs Media-Query Step Typography: Tradeoffs and Anatomy",{"path":2272,"title":2273},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp\u002Fdebugging-clamp-values","Debugging clamp(): Values That Are Ignored, Stuck or Never Fluid",{"path":2275,"title":2276},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp\u002Ffluid-line-height-and-measure","Fluid Line Height and Measure: Keeping Text Readable as It Scales",{"path":2278,"title":2279},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp\u002Ffluid-space-scale-with-clamp","Building a Fluid Spacing Scale with clamp() and Container Units",{"path":2281,"title":2282},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp\u002Ffluid-type-accessibility-and-zoom","Fluid Type, Accessibility and Zoom: The vw-Only Trap",{"path":2284,"title":2285},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp\u002Ffluid-typography-without-javascript","Fluid Typography Without JavaScript: A Precision CSS Reference",{"path":2287,"title":2288},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp","Fluid Typography with clamp(): A Practical Guide for Modern CSS",{"path":2290,"title":2291},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp\u002Ftext-wrap-balance-and-pretty","text-wrap: balance and pretty: Better Line Breaks Without Manual Breaks",{"path":2293,"title":2294},"\u002Fmastering-container-queries-responsive-layouts","Mastering Container Queries & Responsive Layouts",{"path":2296,"title":2297},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Faspect-ratio-for-responsive-media","Using aspect-ratio for Responsive Media and Preventing Layout Shift",{"path":2299,"title":2300},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Fcontent-visibility-and-contain-intrinsic-size","content-visibility and contain-intrinsic-size: Rendering Only What Is Near the Screen",{"path":2302,"title":2303},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques","Intrinsic Sizing Techniques: Modern CSS Layouts for Responsive UI",{"path":2305,"title":2306},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Flayout-widths-with-min-max-clamp","Layout Widths With min(), max() and clamp(): Sizing Without Breakpoints",{"path":2308,"title":2309},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Fmin-max-fit-content-explained","min-content, max-content, and fit-content() Explained",{"path":2311,"title":2312},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Fobject-fit-and-object-position","object-fit and object-position: Images That Fit Any Box",{"path":2314,"title":2315},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Fpreventing-flex-and-grid-overflow","The min-width: auto Trap in Flex and Grid Layouts",{"path":2317,"title":2318},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies\u002Fcascade-layers-for-reset-and-tokens","Cascade Layers for Reset and Design Tokens",{"path":2320,"title":2321},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies\u002Fcascade-layers-vs-specificity-hacks","Cascade Layers vs Specificity Hacks: Ordering Instead of Escalating",{"path":2323,"title":2324},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies\u002Fcss-scope-for-component-styles","@scope for Component Styles: Short Selectors That Cannot Leak",{"path":2326,"title":2327},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies","Modern CSS Reset Strategies: A Spec-Compliant Foundation",{"path":2329,"title":2330},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies\u002Frevert-layer-and-revert-keywords","initial, inherit, unset, revert and revert-layer: Undoing Styles Correctly",{"path":2332,"title":2333},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies\u002Fwriting-a-minimal-modern-reset","Writing a Minimal Modern CSS Reset: Every Line Justified",{"path":2335,"title":2336},"\u002Fmastering-container-queries-responsive-layouts\u002Fparent-aware-layouts-with-has\u002Fcontent-aware-card-layouts-with-has","Content-Aware Card Layouts With :has(): One Component, Many Shapes",{"path":2338,"title":2339},"\u002Fmastering-container-queries-responsive-layouts\u002Fparent-aware-layouts-with-has\u002Fempty-and-loading-states-with-has","Empty and Loading States With ()",{"path":2341,"title":2342},"\u002Fmastering-container-queries-responsive-layouts\u002Fparent-aware-layouts-with-has\u002Fform-validation-layouts-with-has","Form Validation Layouts With :has(): Styling Groups From Field State",{"path":2344,"title":2345},"\u002Fmastering-container-queries-responsive-layouts\u002Fparent-aware-layouts-with-has\u002Fhas-selector-performance",":has() Selector Performance: What Is Cheap, What Is Not, and How to Measure",{"path":2347,"title":2348},"\u002Fmastering-container-queries-responsive-layouts\u002Fparent-aware-layouts-with-has\u002Fhas-vs-container-style-queries",":has() vs Container Style Queries: Discovered State and Published State",{"path":2350,"title":2351},"\u002Fmastering-container-queries-responsive-layouts\u002Fparent-aware-layouts-with-has","Parent-Aware Layouts With :has(): Letting Containers React to Their Contents",{"path":2353,"title":2354},"\u002Fmastering-container-queries-responsive-layouts\u002Fparent-aware-layouts-with-has\u002Fquantity-queries-with-has","Quantity Queries With :has(): Layouts That Respond to How Many Items There Are",{"path":2356,"title":2357},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fbuilding-responsive-cards-with-container-queries","Building Responsive Cards with Container Queries: A Production-Ready Guide",{"path":2359,"title":2360},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fcontainer-query-data-tables","Container Query Data Tables: Reflowing Tables to Cards",{"path":2362,"title":2363},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fcontainer-query-sidebar-layouts","Container Query Sidebar Layouts That Travel Between Contexts",{"path":2365,"title":2366},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns","Responsive Component Patterns: Architecture & Implementation",{"path":2368,"title":2369},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fresponsive-forms-with-container-queries","Responsive Forms with Container Queries: Reflow Without Losing the Wiring",{"path":2371,"title":2372},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fresponsive-hero-sections-with-container-queries","Responsive Hero Sections With Container Queries",{"path":2374,"title":2375},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fresponsive-navigation-without-media-queries","Responsive Navigation Without Media Queries Using Container Queries",{"path":2377,"title":2378},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fresponsive-pricing-tables","Responsive Pricing Tables: Aligned Features, a Clear Recommendation, Any Width",{"path":2380,"title":2381},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Ftabs-that-become-accordions","Tabs That Become an Accordion: One Component, Two Layouts",{"path":2383,"title":2384},"\u002Fmastering-container-queries-responsive-layouts\u002Fscroll-snap-and-overflow-layouts\u002Fcss-only-carousel-with-scroll-snap","A CSS-Only Carousel With Scroll Snap",{"path":2386,"title":2387},"\u002Fmastering-container-queries-responsive-layouts\u002Fscroll-snap-and-overflow-layouts\u002Fhorizontal-scrolling-card-rows","Horizontal Scrolling Card Rows: Swipeable Lists That Stay in Their Lane",{"path":2389,"title":2390},"\u002Fmastering-container-queries-responsive-layouts\u002Fscroll-snap-and-overflow-layouts","Scroll Snap & Overflow Layouts: Designing Components That Scroll on Purpose",{"path":2392,"title":2393},"\u002Fmastering-container-queries-responsive-layouts\u002Fscroll-snap-and-overflow-layouts\u002Foverscroll-behavior-for-nested-scrolling","overscroll-behavior: Taming Nested Scrolling, Pull-to-Refresh and Back-Swipe",{"path":2395,"title":2396},"\u002Fmastering-container-queries-responsive-layouts\u002Fscroll-snap-and-overflow-layouts\u002Fscroll-margin-and-scroll-padding-for-sticky-headers","scroll-margin and scroll-padding: Keeping Targets Clear of Sticky Headers",{"path":2398,"title":2399},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state\u002Fcombining-size-and-style-queries","Combining Size and Style Container Queries",{"path":2401,"title":2402},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state\u002Fcontainer-style-query-theming","Container Style Query Theming: One Token Instead of a Variant Class Matrix",{"path":2404,"title":2405},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state","Style Queries and Container State: Token-Driven Component Variants",{"path":2407,"title":2408},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state\u002Fstyle-queries-with-custom-properties","Style Queries With Custom Properties: Declaring, Inheriting, and Matching Tokens",{"path":2410,"title":2411},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state\u002Fstyle-query-component-variants","Component Variants With Style Queries: One Token, Many Looks",{"path":2413,"title":2414},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state\u002Fstyle-query-fallbacks-and-support","Style Query Fallbacks and Support: Designing for Older Browser Versions",{"path":2416,"title":2417},"\u002Fmastering-container-queries-responsive-layouts\u002Fviewport-units-and-mobile-layout\u002Fdvh-svh-lvh-mobile-viewport-units","dvh, svh and lvh: Choosing the Right Mobile Viewport Unit",{"path":2419,"title":2420},"\u002Fmastering-container-queries-responsive-layouts\u002Fviewport-units-and-mobile-layout\u002Ffull-bleed-sections-in-constrained-layouts","Full-Bleed Sections in a Constrained Layout: Breaking Out Without Breaking the Page",{"path":2422,"title":2423},"\u002Fmastering-container-queries-responsive-layouts\u002Fviewport-units-and-mobile-layout","Viewport Units & Mobile Layout: Designing for the Screen You Actually Get",{"path":2425,"title":2426},"\u002Fmastering-container-queries-responsive-layouts\u002Fviewport-units-and-mobile-layout\u002Fsafe-area-insets-for-notched-screens","Safe Area Insets: Designing Around Notches, Corners and Home Indicators",{"path":2428,"title":2429},"\u002Fmastering-container-queries-responsive-layouts\u002Fviewport-units-and-mobile-layout\u002Fviewport-units-vs-container-units","Viewport Units vs Container Units: Choosing the Right Reference Box",{"path":2431,"title":2432},"\u002Fmastering-container-queries-responsive-layouts\u002Fviewport-units-and-mobile-layout\u002Fvirtual-keyboard-and-interactive-widget","Layouts That Survive the Virtual Keyboard",{"title":2434,"caption":2435,"height":2436,"html":2437,"css":2438},"A scroll spy with timeline-scope","Scroll inside the frame. Each link is highlighted while its section crosses the middle of the frame. Browsers without scroll-driven animations show plain links.",340,"\n\u003Cdiv class=\"layout\">\n  \u003Cnav class=\"toc\" aria-label=\"On this page\">\n    \u003Ca href=\"#intro\">Introduction\u003C\u002Fa>\n    \u003Ca href=\"#setup\">Setup\u003C\u002Fa>\n    \u003Ca href=\"#usage\">Usage\u003C\u002Fa>\n  \u003C\u002Fnav>\n  \u003Cmain class=\"article\">\n    \u003Csection id=\"intro\">\u003Ch2>Introduction\u003C\u002Fh2>\u003Cp>Each section declares a named view timeline. The layout hoists the names with timeline-scope.\u003C\u002Fp>\u003C\u002Fsection>\n    \u003Csection id=\"setup\">\u003Ch2>Setup\u003C\u002Fh2>\u003Cp>The navigation links are cousins of the sections, so they can only see the names through the shared ancestor.\u003C\u002Fp>\u003C\u002Fsection>\n    \u003Csection id=\"usage\">\u003Ch2>Usage\u003C\u002Fh2>\u003Cp>Each link animates against its own section's timeline, highlighted between cover 30% and cover 70%.\u003C\u002Fp>\u003C\u002Fsection>\n  \u003C\u002Fmain>\n\u003C\u002Fdiv>","\nbody { margin: 0; }\n.layout { display: grid; grid-template-columns: 8.5rem 1fr; timeline-scope: --intro, --setup, --usage; }\n.toc { position: sticky; top: 0; align-self: start; padding: 1rem 0.5rem; border-inline-end: 1px solid var(--demo-border); display: grid; gap: 0.25rem; }\n.toc a { display: block; padding: 0.25rem 0.5rem; border-radius: 6px; color: inherit; text-decoration: none; font-size: 0.9rem; opacity: 0.6; }\n.article { padding: 0 1.25rem; }\n.article section { min-block-size: 80vh; padding-block: 1rem; }\n.article h2 { margin: 0 0 0.5rem; font-size: 1.1rem; }\n.article p { margin: 0; color: var(--demo-muted); }\n#intro { view-timeline-name: --intro; }\n#setup { view-timeline-name: --setup; }\n#usage { view-timeline-name: --usage; }\n@supports (animation-timeline: view()) {\n  .toc a { animation: spy linear both; animation-range: cover 30% cover 70%; }\n  .toc a[href=\"#intro\"] { animation-timeline: --intro; }\n  .toc a[href=\"#setup\"] { animation-timeline: --setup; }\n  .toc a[href=\"#usage\"] { animation-timeline: --usage; }\n  @keyframes spy {\n    0%, 100% { background: transparent; box-shadow: none; opacity: 0.6; }\n    1%, 99% { background: color-mix(in srgb, var(--demo-accent) 18%, transparent); box-shadow: inset 3px 0 0 var(--demo-accent); opacity: 1; }\n  }\n}",1789717749469]