[{"data":1,"prerenderedAt":2409},["ShallowReactive",2],{"page-\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fpause-controls-for-looping-animations":3,"content-all-pages":1844,"live-demo:a11y-pause-control":2403},{"id":4,"title":5,"body":6,"description":1825,"extension":1826,"meta":1827,"navigation":381,"path":1840,"seo":1841,"stem":1842,"__hash__":1843},"content\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fpause-controls-for-looping-animations\u002Findex.md","Pause Controls for Looping CSS Animations: Meeting WCAG 2.2.2",{"type":7,"value":8,"toc":1815},"minimark",[9,13,33,38,54,183,189,193,196,200,1427,1437,1441,1453,1515,1582,1589,1593,1596,1602,1608,1614,1617,1621,1624,1708,1721,1725,1741,1745,1751,1760,1772,1778,1782,1812],[10,11,5],"h1",{"id":12},"pause-controls-for-looping-css-animations-meeting-wcag-222",[14,15,16,17,21,22,27,28,32],"p",{},"Looping motion is everywhere in modern interfaces: animated hero backgrounds, drifting gradients, pulsing \"live\" badges, auto-scrolling logo strips, rotating product showcases. Each one is small on its own; together they make pages that some readers cannot use. People with attention-related disabilities find persistent motion beside the text they are reading distracting to the point of preventing reading, and some motion triggers dizziness or nausea. WCAG 2.2.2 Pause, Stop, Hide requires a way to stop such motion. This page shows how to build that control in CSS, how to design loops that stop themselves, and how the control fits alongside ",[18,19,20],"code",{},"prefers-reduced-motion",". It belongs to ",[23,24,26],"a",{"href":25},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002F","Accessibility in CSS Animations"," in the ",[23,29,31],{"href":30},"\u002Fcss-only-micro-interactions-animations\u002F","CSS-Only Micro-Interactions & Animations"," guide.",[34,35,37],"h2",{"id":36},"what-the-criterion-actually-requires","What the criterion actually requires",[14,39,40,41,45,46,49,50,53],{},"Success criterion 2.2.2 applies to moving, blinking or scrolling information that meets three conditions: it ",[42,43,44],"strong",{},"starts automatically",", it ",[42,47,48],{},"lasts more than five seconds",", and it is ",[42,51,52],{},"presented in parallel with other content",". For such content there must be a mechanism for the user to pause, stop or hide it — unless the movement is essential to the activity.",[55,56,62,63,62,67,62,71,62,79,62,91,62,97,62,102,62,108,62,113,62,115,62,118,62,121,62,125,62,128,62,130,62,134,62,137,62,141,62,147,62,154,62,159,62,164,62,168,62,172,62,175,62,179],"svg",{"viewBox":57,"role":58,"ariaLabel":59,"xmlns":60,"style":61},"0 0 720 320","img","Decision flow for WCAG 2.2.2: automatic start, longer than five seconds and parallel with other content means a pause, stop or hide mechanism is needed","http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg","width:100%;height:auto;max-width:720px;margin:2rem 0","\n  ",[64,65,66],"title",{},"Does this animation need a pause control?",[68,69,70],"desc",{},"Three yes-or-no questions in sequence: does it start automatically, does it last more than five seconds, is it shown alongside other content. If all three are yes and the motion is not essential, provide a pause, stop or hide mechanism. Any no means the criterion does not apply.",[72,73,78],"text",{"textAnchor":74,"x":75,"y":76,"style":77},"middle","360","26","text-anchor:middle;fill:currentColor;font:700 17px sans-serif","Three questions decide it",[80,81],"rect",{"x":82,"y":83,"width":84,"height":85,"rx":86,"fill":87,"stroke":88,"strokeWidth":89,"opacity":90},"30","56","190","60","10","none","currentColor","1.5","0.6",[72,92,96],{"textAnchor":74,"x":93,"y":94,"style":95},"125","82","text-anchor:middle;fill:currentColor;font:13px sans-serif","Starts on its own?",[72,98,101],{"textAnchor":74,"x":93,"y":99,"style":100},"102","text-anchor:middle;fill:currentColor;font:11px sans-serif","no user action",[103,104],"line",{"x1":105,"y1":106,"x2":107,"y2":106,"stroke":88,"strokeWidth":89,"opacity":90},"220","86","265",[72,109,112],{"textAnchor":74,"x":110,"y":111,"style":100},"242","78","yes",[80,114],{"x":107,"y":83,"width":84,"height":85,"rx":86,"fill":87,"stroke":88,"strokeWidth":89,"opacity":90},[72,116,117],{"textAnchor":74,"x":75,"y":94,"style":95},"Runs over 5 seconds?",[72,119,120],{"textAnchor":74,"x":75,"y":99,"style":100},"including loops",[103,122],{"x1":123,"y1":106,"x2":124,"y2":106,"stroke":88,"strokeWidth":89,"opacity":90},"455","500",[72,126,112],{"textAnchor":74,"x":127,"y":111,"style":100},"477",[80,129],{"x":124,"y":83,"width":84,"height":85,"rx":86,"fill":87,"stroke":88,"strokeWidth":89,"opacity":90},[72,131,133],{"textAnchor":74,"x":132,"y":94,"style":95},"595","Beside other content?",[72,135,136],{"textAnchor":74,"x":132,"y":99,"style":100},"not the whole task",[103,138],{"x1":132,"y1":139,"x2":132,"y2":140,"stroke":88,"strokeWidth":89,"opacity":90},"116","160",[72,142,112],{"textAnchor":143,"x":144,"y":145,"style":146},"start","608","142","text-anchor:start;fill:currentColor;font:11px sans-serif",[80,148],{"x":149,"y":140,"width":150,"height":151,"rx":86,"fill":152,"opacity":153},"420","270","70","#7aa2ff","0.4",[72,155,158],{"textAnchor":74,"x":156,"y":84,"style":157},"555","text-anchor:middle;fill:currentColor;font:700 13px sans-serif","Provide pause, stop or hide",[72,160,163],{"textAnchor":74,"x":156,"y":161,"style":162},"212","text-anchor:middle;fill:currentColor;font:12px sans-serif","unless motion is essential",[80,165],{"x":82,"y":140,"width":166,"height":151,"rx":86,"fill":152,"opacity":167},"330","0.14",[72,169,171],{"textAnchor":74,"x":170,"y":84,"style":157},"195","Any \"no\": 2.2.2 does not apply",[72,173,174],{"textAnchor":74,"x":170,"y":161,"style":162},"still honour reduced motion",[72,176,178],{"textAnchor":74,"x":75,"y":177,"style":162},"276","An animation that stops itself within five seconds never needs a control.",[72,180,182],{"textAnchor":74,"x":75,"y":181,"style":162},"298","That is often the simplest way to comply.",[14,184,185,186,188],{},"Two consequences are worth stating plainly. First, the five-second threshold means the simplest compliant design is an animation that ends: three iterations of a two-second pulse, then stillness. Second, ",[18,187,20],{}," alone does not satisfy the criterion. It helps users who have set that operating-system preference, but 2.2.2 requires a mechanism available to everyone on the page itself. The media query and the control are complementary, not alternatives.",[34,190,192],{"id":191},"the-complete-implementation","The complete implementation",[14,194,195],{},"The page below has a decorative animated background and a pulsing status badge. A single labelled checkbox pauses all of them. Users who prefer reduced motion get the paused state by default, and can still opt back in.",[197,198],"live-demo",{"name":199},"a11y-pause-control",[201,202,207],"pre",{"className":203,"code":204,"language":205,"meta":206,"style":206},"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>Pause control for looping motion\u003C\u002Ftitle>\n\u003Cstyle>\n  body { font: 16px\u002F1.6 system-ui, sans-serif; margin: 0; }\n\n  .hero {\n    position: relative;\n    padding: 3rem 1.5rem;\n    overflow: hidden;\n    background: linear-gradient(120deg, #312e81, #1e3a8a, #0f766e);\n    background-size: 300% 300%;\n    color: #f8fafc;\n    animation: drift 14s ease-in-out infinite alternate;\n  }\n  @keyframes drift {\n    to { background-position: 100% 50%; }\n  }\n\n  .live {\n    display: inline-flex;\n    align-items: center;\n    gap: 0.4rem;\n  }\n  .live::before {\n    content: \"\";\n    width: 0.6rem;\n    height: 0.6rem;\n    border-radius: 50%;\n    background: #f87171;\n    animation: pulse 1.6s ease-in-out infinite;\n  }\n  @keyframes pulse {\n    50% { opacity: 0.35; scale: 0.8; }\n  }\n\n  \u002F* The control: an ordinary checkbox with a visible label. *\u002F\n  .motion-toggle {\n    position: absolute;\n    top: 0.75rem;\n    right: 0.75rem;\n    display: inline-flex;\n    gap: 0.4rem;\n    align-items: center;\n    padding: 0.3rem 0.6rem;\n    border-radius: 6px;\n    background: rgb(15 23 42 \u002F 0.6);\n    font-size: 0.85rem;\n  }\n  .motion-toggle input:focus-visible { outline: 2px solid #f8fafc; outline-offset: 2px; }\n\n  \u002F* Checked = paused. :has() lets the control live anywhere in the page. *\u002F\n  :root:has(#pause-motion:checked) .hero,\n  :root:has(#pause-motion:checked) .live::before {\n    animation-play-state: paused;\n  }\n\n  \u002F* Reduced-motion users start paused, so for them the same checkbox\n     means the opposite: ticking it RESUMES the animation, and its\n     visible label changes to say so. *\u002F\n  @media (prefers-reduced-motion: reduce) {\n    .hero, .live::before { animation-play-state: paused; }\n    :root:has(#pause-motion:checked) .hero,\n    :root:has(#pause-motion:checked) .live::before { animation-play-state: running; }\n    .motion-toggle .label-default { display: none; }\n  }\n  @media (prefers-reduced-motion: no-preference) {\n    .motion-toggle .label-reduced { display: none; }\n  }\n\u003C\u002Fstyle>\n\u003C\u002Fhead>\n\u003Cbody>\n  \u003Cheader class=\"hero\">\n    \u003Clabel class=\"motion-toggle\">\n      \u003Cinput type=\"checkbox\" id=\"pause-motion\">\n      \u003Cspan class=\"label-default\">Pause animation\u003C\u002Fspan>\n      \u003Cspan class=\"label-reduced\">Play animation\u003C\u002Fspan>\n    \u003C\u002Flabel>\n    \u003Ch1>Release 4.2\u003C\u002Fh1>\n    \u003Cp class=\"live\">Live now\u003C\u002Fp>\n  \u003C\u002Fheader>\n\u003C\u002Fbody>\n\u003C\u002Fhtml>\n","html","",[18,208,209,228,248,258,276,301,315,325,376,383,392,406,427,440,478,499,512,538,544,556,581,586,591,599,612,625,639,644,652,665,679,693,708,720,738,743,753,781,786,791,798,806,818,833,847,858,871,882,901,915,943,958,963,1005,1010,1016,1036,1052,1065,1070,1075,1081,1087,1093,1102,1123,1139,1163,1183,1188,1196,1214,1219,1229,1238,1248,1267,1285,1312,1333,1354,1364,1378,1399,1409,1418],{"__ignoreMap":206},[210,211,213,217,221,225],"span",{"class":103,"line":212},1,[210,214,216],{"class":215},"suds8","\u003C!",[210,218,220],{"class":219},"sne4z","doctype",[210,222,224],{"class":223},"s-5SL"," html",[210,226,227],{"class":215},">\n",[210,229,231,234,236,239,242,246],{"class":103,"line":230},2,[210,232,233],{"class":215},"\u003C",[210,235,205],{"class":219},[210,237,238],{"class":223}," lang",[210,240,241],{"class":215},"=",[210,243,245],{"class":244},"sT6z2","\"en\"",[210,247,227],{"class":215},[210,249,251,253,256],{"class":103,"line":250},3,[210,252,233],{"class":215},[210,254,255],{"class":219},"head",[210,257,227],{"class":215},[210,259,261,263,266,269,271,274],{"class":103,"line":260},4,[210,262,233],{"class":215},[210,264,265],{"class":219},"meta",[210,267,268],{"class":223}," charset",[210,270,241],{"class":215},[210,272,273],{"class":244},"\"utf-8\"",[210,275,227],{"class":215},[210,277,279,281,283,286,288,291,294,296,299],{"class":103,"line":278},5,[210,280,233],{"class":215},[210,282,265],{"class":219},[210,284,285],{"class":223}," name",[210,287,241],{"class":215},[210,289,290],{"class":244},"\"viewport\"",[210,292,293],{"class":223}," content",[210,295,241],{"class":215},[210,297,298],{"class":244},"\"width=device-width, initial-scale=1\"",[210,300,227],{"class":215},[210,302,304,306,308,311,313],{"class":103,"line":303},6,[210,305,233],{"class":215},[210,307,64],{"class":219},[210,309,310],{"class":215},">Pause control for looping motion\u003C\u002F",[210,312,64],{"class":219},[210,314,227],{"class":215},[210,316,318,320,323],{"class":103,"line":317},7,[210,319,233],{"class":215},[210,321,322],{"class":219},"style",[210,324,227],{"class":215},[210,326,328,331,334,337,340,343,347,350,353,356,359,362,365,368,370,373],{"class":103,"line":327},8,[210,329,330],{"class":219},"  body",[210,332,333],{"class":215}," { ",[210,335,336],{"class":223},"font",[210,338,339],{"class":215},": ",[210,341,342],{"class":223},"16",[210,344,346],{"class":345},"sHUrx","px",[210,348,349],{"class":215},"\u002F",[210,351,352],{"class":223},"1.6",[210,354,355],{"class":223}," system-ui",[210,357,358],{"class":215},", ",[210,360,361],{"class":223},"sans-serif",[210,363,364],{"class":215},"; ",[210,366,367],{"class":223},"margin",[210,369,339],{"class":215},[210,371,372],{"class":223},"0",[210,374,375],{"class":215},"; }\n",[210,377,379],{"class":103,"line":378},9,[210,380,382],{"emptyLinePlaceholder":381},true,"\n",[210,384,386,389],{"class":103,"line":385},10,[210,387,388],{"class":223},"  .hero",[210,390,391],{"class":215}," {\n",[210,393,395,398,400,403],{"class":103,"line":394},11,[210,396,397],{"class":223},"    position",[210,399,339],{"class":215},[210,401,402],{"class":223},"relative",[210,404,405],{"class":215},";\n",[210,407,409,412,414,417,420,423,425],{"class":103,"line":408},12,[210,410,411],{"class":223},"    padding",[210,413,339],{"class":215},[210,415,416],{"class":223},"3",[210,418,419],{"class":345},"rem",[210,421,422],{"class":223}," 1.5",[210,424,419],{"class":345},[210,426,405],{"class":215},[210,428,430,433,435,438],{"class":103,"line":429},13,[210,431,432],{"class":223},"    overflow",[210,434,339],{"class":215},[210,436,437],{"class":223},"hidden",[210,439,405],{"class":215},[210,441,443,446,448,451,454,457,460,462,465,467,470,472,475],{"class":103,"line":442},14,[210,444,445],{"class":223},"    background",[210,447,339],{"class":215},[210,449,450],{"class":223},"linear-gradient",[210,452,453],{"class":215},"(",[210,455,456],{"class":223},"120",[210,458,459],{"class":345},"deg",[210,461,358],{"class":215},[210,463,464],{"class":223},"#312e81",[210,466,358],{"class":215},[210,468,469],{"class":223},"#1e3a8a",[210,471,358],{"class":215},[210,473,474],{"class":223},"#0f766e",[210,476,477],{"class":215},");\n",[210,479,481,484,486,489,492,495,497],{"class":103,"line":480},15,[210,482,483],{"class":223},"    background-size",[210,485,339],{"class":215},[210,487,488],{"class":223},"300",[210,490,491],{"class":345},"%",[210,493,494],{"class":223}," 300",[210,496,491],{"class":345},[210,498,405],{"class":215},[210,500,502,505,507,510],{"class":103,"line":501},16,[210,503,504],{"class":223},"    color",[210,506,339],{"class":215},[210,508,509],{"class":223},"#f8fafc",[210,511,405],{"class":215},[210,513,515,518,521,524,527,530,533,536],{"class":103,"line":514},17,[210,516,517],{"class":223},"    animation",[210,519,520],{"class":215},": drift ",[210,522,523],{"class":223},"14",[210,525,526],{"class":345},"s",[210,528,529],{"class":223}," ease-in-out",[210,531,532],{"class":223}," infinite",[210,534,535],{"class":223}," alternate",[210,537,405],{"class":215},[210,539,541],{"class":103,"line":540},18,[210,542,543],{"class":215},"  }\n",[210,545,547,550,554],{"class":103,"line":546},19,[210,548,549],{"class":345},"  @keyframes",[210,551,553],{"class":552},"soyes"," drift",[210,555,391],{"class":215},[210,557,559,562,564,567,569,572,574,577,579],{"class":103,"line":558},20,[210,560,561],{"class":223},"    to",[210,563,333],{"class":215},[210,565,566],{"class":223},"background-position",[210,568,339],{"class":215},[210,570,571],{"class":223},"100",[210,573,491],{"class":345},[210,575,576],{"class":223}," 50",[210,578,491],{"class":345},[210,580,375],{"class":215},[210,582,584],{"class":103,"line":583},21,[210,585,543],{"class":215},[210,587,589],{"class":103,"line":588},22,[210,590,382],{"emptyLinePlaceholder":381},[210,592,594,597],{"class":103,"line":593},23,[210,595,596],{"class":223},"  .live",[210,598,391],{"class":215},[210,600,602,605,607,610],{"class":103,"line":601},24,[210,603,604],{"class":223},"    display",[210,606,339],{"class":215},[210,608,609],{"class":223},"inline-flex",[210,611,405],{"class":215},[210,613,615,618,620,623],{"class":103,"line":614},25,[210,616,617],{"class":223},"    align-items",[210,619,339],{"class":215},[210,621,622],{"class":223},"center",[210,624,405],{"class":215},[210,626,628,631,633,635,637],{"class":103,"line":627},26,[210,629,630],{"class":223},"    gap",[210,632,339],{"class":215},[210,634,153],{"class":223},[210,636,419],{"class":345},[210,638,405],{"class":215},[210,640,642],{"class":103,"line":641},27,[210,643,543],{"class":215},[210,645,647,650],{"class":103,"line":646},28,[210,648,649],{"class":223},"  .live::before",[210,651,391],{"class":215},[210,653,655,658,660,663],{"class":103,"line":654},29,[210,656,657],{"class":223},"    content",[210,659,339],{"class":215},[210,661,662],{"class":244},"\"\"",[210,664,405],{"class":215},[210,666,668,671,673,675,677],{"class":103,"line":667},30,[210,669,670],{"class":223},"    width",[210,672,339],{"class":215},[210,674,90],{"class":223},[210,676,419],{"class":345},[210,678,405],{"class":215},[210,680,682,685,687,689,691],{"class":103,"line":681},31,[210,683,684],{"class":223},"    height",[210,686,339],{"class":215},[210,688,90],{"class":223},[210,690,419],{"class":345},[210,692,405],{"class":215},[210,694,696,699,701,704,706],{"class":103,"line":695},32,[210,697,698],{"class":223},"    border-radius",[210,700,339],{"class":215},[210,702,703],{"class":223},"50",[210,705,491],{"class":345},[210,707,405],{"class":215},[210,709,711,713,715,718],{"class":103,"line":710},33,[210,712,445],{"class":223},[210,714,339],{"class":215},[210,716,717],{"class":223},"#f87171",[210,719,405],{"class":215},[210,721,723,725,728,730,732,734,736],{"class":103,"line":722},34,[210,724,517],{"class":223},[210,726,727],{"class":215},": pulse ",[210,729,352],{"class":223},[210,731,526],{"class":345},[210,733,529],{"class":223},[210,735,532],{"class":223},[210,737,405],{"class":215},[210,739,741],{"class":103,"line":740},35,[210,742,543],{"class":215},[210,744,746,748,751],{"class":103,"line":745},36,[210,747,549],{"class":345},[210,749,750],{"class":552}," pulse",[210,752,391],{"class":215},[210,754,756,759,761,764,766,769,771,774,776,779],{"class":103,"line":755},37,[210,757,758],{"class":223},"    50%",[210,760,333],{"class":215},[210,762,763],{"class":223},"opacity",[210,765,339],{"class":215},[210,767,768],{"class":223},"0.35",[210,770,364],{"class":215},[210,772,773],{"class":223},"scale",[210,775,339],{"class":215},[210,777,778],{"class":223},"0.8",[210,780,375],{"class":215},[210,782,784],{"class":103,"line":783},38,[210,785,543],{"class":215},[210,787,789],{"class":103,"line":788},39,[210,790,382],{"emptyLinePlaceholder":381},[210,792,794],{"class":103,"line":793},40,[210,795,797],{"class":796},"sLBg1","  \u002F* The control: an ordinary checkbox with a visible label. *\u002F\n",[210,799,801,804],{"class":103,"line":800},41,[210,802,803],{"class":223},"  .motion-toggle",[210,805,391],{"class":215},[210,807,809,811,813,816],{"class":103,"line":808},42,[210,810,397],{"class":223},[210,812,339],{"class":215},[210,814,815],{"class":223},"absolute",[210,817,405],{"class":215},[210,819,821,824,826,829,831],{"class":103,"line":820},43,[210,822,823],{"class":223},"    top",[210,825,339],{"class":215},[210,827,828],{"class":223},"0.75",[210,830,419],{"class":345},[210,832,405],{"class":215},[210,834,836,839,841,843,845],{"class":103,"line":835},44,[210,837,838],{"class":223},"    right",[210,840,339],{"class":215},[210,842,828],{"class":223},[210,844,419],{"class":345},[210,846,405],{"class":215},[210,848,850,852,854,856],{"class":103,"line":849},45,[210,851,604],{"class":223},[210,853,339],{"class":215},[210,855,609],{"class":223},[210,857,405],{"class":215},[210,859,861,863,865,867,869],{"class":103,"line":860},46,[210,862,630],{"class":223},[210,864,339],{"class":215},[210,866,153],{"class":223},[210,868,419],{"class":345},[210,870,405],{"class":215},[210,872,874,876,878,880],{"class":103,"line":873},47,[210,875,617],{"class":223},[210,877,339],{"class":215},[210,879,622],{"class":223},[210,881,405],{"class":215},[210,883,885,887,889,892,894,897,899],{"class":103,"line":884},48,[210,886,411],{"class":223},[210,888,339],{"class":215},[210,890,891],{"class":223},"0.3",[210,893,419],{"class":345},[210,895,896],{"class":223}," 0.6",[210,898,419],{"class":345},[210,900,405],{"class":215},[210,902,904,906,908,911,913],{"class":103,"line":903},49,[210,905,698],{"class":223},[210,907,339],{"class":215},[210,909,910],{"class":223},"6",[210,912,346],{"class":345},[210,914,405],{"class":215},[210,916,918,920,922,925,927,930,933,936,939,941],{"class":103,"line":917},50,[210,919,445],{"class":223},[210,921,339],{"class":215},[210,923,924],{"class":223},"rgb",[210,926,453],{"class":215},[210,928,929],{"class":223},"15",[210,931,932],{"class":223}," 23",[210,934,935],{"class":223}," 42",[210,937,938],{"class":215}," \u002F ",[210,940,90],{"class":223},[210,942,477],{"class":215},[210,944,946,949,951,954,956],{"class":103,"line":945},51,[210,947,948],{"class":223},"    font-size",[210,950,339],{"class":215},[210,952,953],{"class":223},"0.85",[210,955,419],{"class":345},[210,957,405],{"class":215},[210,959,961],{"class":103,"line":960},52,[210,962,543],{"class":215},[210,964,966,968,971,974,976,979,981,984,986,989,992,994,997,999,1001,1003],{"class":103,"line":965},53,[210,967,803],{"class":223},[210,969,970],{"class":219}," input",[210,972,973],{"class":223},":focus-visible",[210,975,333],{"class":215},[210,977,978],{"class":223},"outline",[210,980,339],{"class":215},[210,982,983],{"class":223},"2",[210,985,346],{"class":345},[210,987,988],{"class":223}," solid",[210,990,991],{"class":223}," #f8fafc",[210,993,364],{"class":215},[210,995,996],{"class":223},"outline-offset",[210,998,339],{"class":215},[210,1000,983],{"class":223},[210,1002,346],{"class":345},[210,1004,375],{"class":215},[210,1006,1008],{"class":103,"line":1007},54,[210,1009,382],{"emptyLinePlaceholder":381},[210,1011,1013],{"class":103,"line":1012},55,[210,1014,1015],{"class":796},"  \u002F* Checked = paused. :has() lets the control live anywhere in the page. *\u002F\n",[210,1017,1019,1022,1024,1027,1030,1033],{"class":103,"line":1018},56,[210,1020,1021],{"class":223},"  :root:has",[210,1023,453],{"class":215},[210,1025,1026],{"class":223},"#pause-motion:checked",[210,1028,1029],{"class":215},") ",[210,1031,1032],{"class":223},".hero",[210,1034,1035],{"class":215},",\n",[210,1037,1039,1041,1043,1045,1047,1050],{"class":103,"line":1038},57,[210,1040,1021],{"class":223},[210,1042,453],{"class":215},[210,1044,1026],{"class":223},[210,1046,1029],{"class":215},[210,1048,1049],{"class":223},".live::before",[210,1051,391],{"class":215},[210,1053,1055,1058,1060,1063],{"class":103,"line":1054},58,[210,1056,1057],{"class":223},"    animation-play-state",[210,1059,339],{"class":215},[210,1061,1062],{"class":223},"paused",[210,1064,405],{"class":215},[210,1066,1068],{"class":103,"line":1067},59,[210,1069,543],{"class":215},[210,1071,1073],{"class":103,"line":1072},60,[210,1074,382],{"emptyLinePlaceholder":381},[210,1076,1078],{"class":103,"line":1077},61,[210,1079,1080],{"class":796},"  \u002F* Reduced-motion users start paused, so for them the same checkbox\n",[210,1082,1084],{"class":103,"line":1083},62,[210,1085,1086],{"class":796},"     means the opposite: ticking it RESUMES the animation, and its\n",[210,1088,1090],{"class":103,"line":1089},63,[210,1091,1092],{"class":796},"     visible label changes to say so. *\u002F\n",[210,1094,1096,1099],{"class":103,"line":1095},64,[210,1097,1098],{"class":345},"  @media",[210,1100,1101],{"class":215}," (prefers-reduced-motion: reduce) {\n",[210,1103,1105,1108,1110,1112,1114,1117,1119,1121],{"class":103,"line":1104},65,[210,1106,1107],{"class":223},"    .hero",[210,1109,358],{"class":215},[210,1111,1049],{"class":223},[210,1113,333],{"class":215},[210,1115,1116],{"class":223},"animation-play-state",[210,1118,339],{"class":215},[210,1120,1062],{"class":223},[210,1122,375],{"class":215},[210,1124,1126,1129,1131,1133,1135,1137],{"class":103,"line":1125},66,[210,1127,1128],{"class":223},"    :root:has",[210,1130,453],{"class":215},[210,1132,1026],{"class":223},[210,1134,1029],{"class":215},[210,1136,1032],{"class":223},[210,1138,1035],{"class":215},[210,1140,1142,1144,1146,1148,1150,1152,1154,1156,1158,1161],{"class":103,"line":1141},67,[210,1143,1128],{"class":223},[210,1145,453],{"class":215},[210,1147,1026],{"class":223},[210,1149,1029],{"class":215},[210,1151,1049],{"class":223},[210,1153,333],{"class":215},[210,1155,1116],{"class":223},[210,1157,339],{"class":215},[210,1159,1160],{"class":223},"running",[210,1162,375],{"class":215},[210,1164,1166,1169,1172,1174,1177,1179,1181],{"class":103,"line":1165},68,[210,1167,1168],{"class":223},"    .motion-toggle",[210,1170,1171],{"class":223}," .label-default",[210,1173,333],{"class":215},[210,1175,1176],{"class":223},"display",[210,1178,339],{"class":215},[210,1180,87],{"class":223},[210,1182,375],{"class":215},[210,1184,1186],{"class":103,"line":1185},69,[210,1187,543],{"class":215},[210,1189,1191,1193],{"class":103,"line":1190},70,[210,1192,1098],{"class":345},[210,1194,1195],{"class":215}," (prefers-reduced-motion: no-preference) {\n",[210,1197,1199,1201,1204,1206,1208,1210,1212],{"class":103,"line":1198},71,[210,1200,1168],{"class":223},[210,1202,1203],{"class":223}," .label-reduced",[210,1205,333],{"class":215},[210,1207,1176],{"class":223},[210,1209,339],{"class":215},[210,1211,87],{"class":223},[210,1213,375],{"class":215},[210,1215,1217],{"class":103,"line":1216},72,[210,1218,543],{"class":215},[210,1220,1222,1225,1227],{"class":103,"line":1221},73,[210,1223,1224],{"class":215},"\u003C\u002F",[210,1226,322],{"class":219},[210,1228,227],{"class":215},[210,1230,1232,1234,1236],{"class":103,"line":1231},74,[210,1233,1224],{"class":215},[210,1235,255],{"class":219},[210,1237,227],{"class":215},[210,1239,1241,1243,1246],{"class":103,"line":1240},75,[210,1242,233],{"class":215},[210,1244,1245],{"class":219},"body",[210,1247,227],{"class":215},[210,1249,1251,1254,1257,1260,1262,1265],{"class":103,"line":1250},76,[210,1252,1253],{"class":215},"  \u003C",[210,1255,1256],{"class":219},"header",[210,1258,1259],{"class":223}," class",[210,1261,241],{"class":215},[210,1263,1264],{"class":244},"\"hero\"",[210,1266,227],{"class":215},[210,1268,1270,1273,1276,1278,1280,1283],{"class":103,"line":1269},77,[210,1271,1272],{"class":215},"    \u003C",[210,1274,1275],{"class":219},"label",[210,1277,1259],{"class":223},[210,1279,241],{"class":215},[210,1281,1282],{"class":244},"\"motion-toggle\"",[210,1284,227],{"class":215},[210,1286,1288,1291,1294,1297,1299,1302,1305,1307,1310],{"class":103,"line":1287},78,[210,1289,1290],{"class":215},"      \u003C",[210,1292,1293],{"class":219},"input",[210,1295,1296],{"class":223}," type",[210,1298,241],{"class":215},[210,1300,1301],{"class":244},"\"checkbox\"",[210,1303,1304],{"class":223}," id",[210,1306,241],{"class":215},[210,1308,1309],{"class":244},"\"pause-motion\"",[210,1311,227],{"class":215},[210,1313,1315,1317,1319,1321,1323,1326,1329,1331],{"class":103,"line":1314},79,[210,1316,1290],{"class":215},[210,1318,210],{"class":219},[210,1320,1259],{"class":223},[210,1322,241],{"class":215},[210,1324,1325],{"class":244},"\"label-default\"",[210,1327,1328],{"class":215},">Pause animation\u003C\u002F",[210,1330,210],{"class":219},[210,1332,227],{"class":215},[210,1334,1336,1338,1340,1342,1344,1347,1350,1352],{"class":103,"line":1335},80,[210,1337,1290],{"class":215},[210,1339,210],{"class":219},[210,1341,1259],{"class":223},[210,1343,241],{"class":215},[210,1345,1346],{"class":244},"\"label-reduced\"",[210,1348,1349],{"class":215},">Play animation\u003C\u002F",[210,1351,210],{"class":219},[210,1353,227],{"class":215},[210,1355,1357,1360,1362],{"class":103,"line":1356},81,[210,1358,1359],{"class":215},"    \u003C\u002F",[210,1361,1275],{"class":219},[210,1363,227],{"class":215},[210,1365,1367,1369,1371,1374,1376],{"class":103,"line":1366},82,[210,1368,1272],{"class":215},[210,1370,10],{"class":219},[210,1372,1373],{"class":215},">Release 4.2\u003C\u002F",[210,1375,10],{"class":219},[210,1377,227],{"class":215},[210,1379,1381,1383,1385,1387,1389,1392,1395,1397],{"class":103,"line":1380},83,[210,1382,1272],{"class":215},[210,1384,14],{"class":219},[210,1386,1259],{"class":223},[210,1388,241],{"class":215},[210,1390,1391],{"class":244},"\"live\"",[210,1393,1394],{"class":215},">Live now\u003C\u002F",[210,1396,14],{"class":219},[210,1398,227],{"class":215},[210,1400,1402,1405,1407],{"class":103,"line":1401},84,[210,1403,1404],{"class":215},"  \u003C\u002F",[210,1406,1256],{"class":219},[210,1408,227],{"class":215},[210,1410,1412,1414,1416],{"class":103,"line":1411},85,[210,1413,1224],{"class":215},[210,1415,1245],{"class":219},[210,1417,227],{"class":215},[210,1419,1421,1423,1425],{"class":103,"line":1420},86,[210,1422,1224],{"class":215},[210,1424,205],{"class":219},[210,1426,227],{"class":215},[14,1428,1429,1432,1433,1436],{},[18,1430,1431],{},"animation-play-state: paused"," freezes an animation at its current frame rather than resetting it, so pausing never causes a jump, and resuming continues from the same point. The control is a real ",[18,1434,1435],{},"\u003Cinput type=\"checkbox\">",", so it is focusable, operable with Space, and announced as \"Pause animation, checkbox, not checked\". Its label text changes meaning for reduced-motion users, who start paused, so the same box reads \"Play animation\" for them.",[34,1438,1440],{"id":1439},"the-key-technique-one-control-many-animations","The key technique: one control, many animations",[14,1442,1443,1444,1448,1449,1452],{},"A pause control is only useful if it stops ",[1445,1446,1447],"em",{},"everything"," that moves. The ",[18,1450,1451],{},":root:has(#pause-motion:checked)"," pattern lets one checkbox, placed wherever the design wants it, reach every animated element on the page. Adding a new animation means adding its selector to the paused list — or, more robustly, giving every decorative animation a shared class.",[55,1454,62,1457,62,1460,62,1463,62,1465,62,1470,62,1475,62,1479,62,1484,62,1486,62,1488,62,1492,62,1497,62,1500,62,1504,62,1507,62,1511],{"viewBox":1455,"role":58,"ariaLabel":1456,"xmlns":60,"style":61},"0 0 720 280","One checkbox affecting three separately animated elements through a root-level has selector",[64,1458,1459],{},"A single switch for every loop",[68,1461,1462],{},"A checkbox labelled pause animation feeds a root-level has selector. Lines fan out to a hero background, a live badge and a logo strip, each set to animation-play-state paused when the box is checked.",[72,1464,1451],{"textAnchor":74,"x":75,"y":76,"style":77},[80,1466],{"x":1467,"y":1468,"width":1469,"height":85,"rx":86,"fill":152,"opacity":153},"40","110","200",[72,1471,1474],{"textAnchor":74,"x":1472,"y":1473,"style":157},"140","136","☐ Pause animation",[72,1476,1478],{"textAnchor":74,"x":1472,"y":1477,"style":100},"156","one real checkbox",[103,1480],{"x1":1481,"y1":1472,"x2":1482,"y2":1483,"stroke":88,"strokeWidth":89,"opacity":90},"240","440","80",[103,1485],{"x1":1481,"y1":1472,"x2":1482,"y2":1472,"stroke":88,"strokeWidth":89,"opacity":90},[103,1487],{"x1":1481,"y1":1472,"x2":1482,"y2":1469,"stroke":88,"strokeWidth":89,"opacity":90},[80,1489],{"x":1482,"y":83,"width":1481,"height":1490,"rx":1491,"fill":87,"stroke":88,"strokeWidth":89,"opacity":90},"46","8",[72,1493,1496],{"textAnchor":74,"x":1494,"y":1495,"style":162},"560","84","hero gradient drift",[80,1498],{"x":1482,"y":1499,"width":1481,"height":1490,"rx":1491,"fill":87,"stroke":88,"strokeWidth":89,"opacity":90},"117",[72,1501,1503],{"textAnchor":74,"x":1494,"y":1502,"style":162},"145","live badge pulse",[80,1505],{"x":1482,"y":1506,"width":1481,"height":1490,"rx":1491,"fill":87,"stroke":88,"strokeWidth":89,"opacity":90},"178",[72,1508,1510],{"textAnchor":74,"x":1494,"y":1509,"style":162},"206","logo strip marquee",[72,1512,1431],{"textAnchor":74,"x":75,"y":1513,"style":1514},"258","text-anchor:middle;fill:currentColor;font:12px ui-monospace,monospace",[201,1516,1520],{"className":1517,"code":1518,"language":1519,"meta":206,"style":206},"language-css shiki shiki-themes github-light-high-contrast github-dark-high-contrast","\u002F* Tag every decorative loop once... *\u002F\n.loops { animation-play-state: var(--loops-state, running); }\n\n\u002F* ...and flip the shared state from the control. *\u002F\n:root:has(#pause-motion:checked) { --loops-state: paused; }\n","css",[18,1521,1522,1527,1553,1557,1562],{"__ignoreMap":206},[210,1523,1524],{"class":103,"line":212},[210,1525,1526],{"class":796},"\u002F* Tag every decorative loop once... *\u002F\n",[210,1528,1529,1532,1534,1536,1538,1541,1543,1546,1548,1550],{"class":103,"line":230},[210,1530,1531],{"class":223},".loops",[210,1533,333],{"class":215},[210,1535,1116],{"class":223},[210,1537,339],{"class":215},[210,1539,1540],{"class":223},"var",[210,1542,453],{"class":215},[210,1544,1545],{"class":552},"--loops-state",[210,1547,358],{"class":215},[210,1549,1160],{"class":223},[210,1551,1552],{"class":215},"); }\n",[210,1554,1555],{"class":103,"line":250},[210,1556,382],{"emptyLinePlaceholder":381},[210,1558,1559],{"class":103,"line":260},[210,1560,1561],{"class":796},"\u002F* ...and flip the shared state from the control. *\u002F\n",[210,1563,1564,1567,1569,1571,1574,1576,1578,1580],{"class":103,"line":278},[210,1565,1566],{"class":223},":root:has",[210,1568,453],{"class":215},[210,1570,1026],{"class":223},[210,1572,1573],{"class":215},") { ",[210,1575,1545],{"class":552},[210,1577,339],{"class":215},[210,1579,1062],{"class":223},[210,1581,375],{"class":215},[14,1583,1584,1585,1588],{},"The custom-property version is the one to adopt in a codebase: components opt in by adding the ",[18,1586,1587],{},"loops"," class, and the page-level control never needs to know which components exist. The same variable can also be set from a site-wide preference stored in local storage and applied by a small script, so a user's choice persists across pages — which the checkbox alone cannot do.",[34,1590,1592],{"id":1591},"where-to-put-the-control-and-what-it-should-say","Where to put the control, and what it should say",[14,1594,1595],{},"A pause control that users cannot find does not meet the criterion in spirit. Three placement guidelines help.",[14,1597,1598,1601],{},[42,1599,1600],{},"Put it near the motion or at the top of the page."," A control inside the animated region, as in the example, is discoverable because it sits where the eye already is. A site-wide control in the header — \"Reduce motion\" beside the theme toggle — is discoverable because it is in a predictable place and applies everywhere. Controls buried in a footer or a settings page arrive too late for someone already struggling to read.",[14,1603,1604,1607],{},[42,1605,1606],{},"Make it reachable early in the tab order."," Keyboard users should meet the control before they reach the content the motion is distracting them from. For a hero animation, the control belongs at the start of the hero's DOM, not the end.",[14,1609,1610,1613],{},[42,1611,1612],{},"Label the action, not the state."," \"Pause animation\" says exactly what ticking the box does. Labels such as \"Motion\" or an unlabelled icon leave users guessing whether the current state is on or off. If an icon is used for compactness, it still needs an accessible name, and the visible target must be large enough to hit comfortably.",[14,1615,1616],{},"Persisting the choice is worth the few lines of script it takes. A user who pauses motion on one page will expect the next page to respect that choice, and asking them to pause every page individually is a small but real barrier. Storing the preference and applying the paused state before first paint — the same technique used for theme preferences — makes the control feel like a setting rather than a per-page chore.",[34,1618,1620],{"id":1619},"designing-loops-that-stop-themselves","Designing loops that stop themselves",[14,1622,1623],{},"The most accessible looping animation is one that does not loop forever. Many decorative effects work just as well with a finite iteration count.",[201,1625,1627],{"className":1517,"code":1626,"language":1519,"meta":206,"style":206},"\u002F* Pulse three times to draw attention, then rest. 3 × 1.6s = 4.8s,\n   under the five-second threshold, so no control is required. *\u002F\n.badge-new::before {\n  animation: pulse 1.6s ease-in-out 3;\n}\n\n\u002F* A marquee that scrolls once and stops at its start. *\u002F\n.logos__track {\n  animation: marquee 30s linear 1;\n}\n",[18,1628,1629,1634,1639,1646,1664,1669,1673,1678,1685,1704],{"__ignoreMap":206},[210,1630,1631],{"class":103,"line":212},[210,1632,1633],{"class":796},"\u002F* Pulse three times to draw attention, then rest. 3 × 1.6s = 4.8s,\n",[210,1635,1636],{"class":103,"line":230},[210,1637,1638],{"class":796},"   under the five-second threshold, so no control is required. *\u002F\n",[210,1640,1641,1644],{"class":103,"line":250},[210,1642,1643],{"class":223},".badge-new::before",[210,1645,391],{"class":215},[210,1647,1648,1651,1653,1655,1657,1659,1662],{"class":103,"line":260},[210,1649,1650],{"class":223},"  animation",[210,1652,727],{"class":215},[210,1654,352],{"class":223},[210,1656,526],{"class":345},[210,1658,529],{"class":223},[210,1660,1661],{"class":223}," 3",[210,1663,405],{"class":215},[210,1665,1666],{"class":103,"line":278},[210,1667,1668],{"class":215},"}\n",[210,1670,1671],{"class":103,"line":303},[210,1672,382],{"emptyLinePlaceholder":381},[210,1674,1675],{"class":103,"line":317},[210,1676,1677],{"class":796},"\u002F* A marquee that scrolls once and stops at its start. *\u002F\n",[210,1679,1680,1683],{"class":103,"line":327},[210,1681,1682],{"class":223},".logos__track",[210,1684,391],{"class":215},[210,1686,1687,1689,1692,1694,1696,1699,1702],{"class":103,"line":378},[210,1688,1650],{"class":223},[210,1690,1691],{"class":215},": marquee ",[210,1693,82],{"class":223},[210,1695,526],{"class":345},[210,1697,1698],{"class":223}," linear",[210,1700,1701],{"class":223}," 1",[210,1703,405],{"class":215},[210,1705,1706],{"class":103,"line":385},[210,1707,1668],{"class":215},[14,1709,1710,1711,1715,1716,1720],{},"Where a loop truly needs to continue — a \"recording\" indicator, a live-stream badge — keep it small, subtle and slow, and still include it in the pause mechanism. Motion that is essential to the meaning, such as a progress indicator during a genuine wait, is exempt, but it should stop when the wait ends. The broader patterns for motion preferences are in ",[23,1712,1714],{"href":1713},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fprefers-reduced-motion-recipes\u002F","prefers-reduced-motion Recipes",", and the success criteria themselves are summarised in ",[23,1717,1719],{"href":1718},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fwcag-motion-success-criteria\u002F","WCAG Motion Success Criteria",".",[34,1722,1724],{"id":1723},"browser-support","Browser support",[14,1726,1727,1729,1730,1733,1734,1737,1738,1740],{},[18,1728,1116],{}," is supported in Chrome 43+, Edge 12+, Firefox 16+ and Safari 9+. ",[18,1731,1732],{},":has()",", used to let the control affect the whole page, is supported in Chrome and Edge 105+, Firefox 121+ and Safari 15.4+; where it is missing, place the checkbox before the animated content and use the general sibling combinator (",[18,1735,1736],{},"#pause-motion:checked ~ .hero",") instead. ",[18,1739,20],{}," is supported in Chrome 74+, Edge 79+, Firefox 63+ and Safari 10.1+.",[34,1742,1744],{"id":1743},"faq","FAQ",[14,1746,1747,1750],{},[42,1748,1749],{},"When does WCAG 2.2.2 require a pause control?","\nWhen moving, blinking or scrolling content starts automatically, lasts more than five seconds, and is presented in parallel with other content. A decorative looping animation beside an article meets all three conditions, so it needs a way to pause, stop or hide it.",[14,1752,1753,1759],{},[42,1754,1755,1756,1758],{},"Is honouring ",[18,1757,20],{}," enough to meet 2.2.2?","\nNo. The media query only helps users who have set the operating-system preference. 2.2.2 requires a mechanism on the page for everyone, including users who never found or changed that setting. Use both: stop motion by default for reduced-motion users and provide a visible pause control.",[14,1761,1762,1765,1766,1768,1769,1771],{},[42,1763,1764],{},"Can CSS alone provide a pause button?","\nYes. A checkbox with a clear label can toggle ",[18,1767,1431],{}," on the animations through ",[18,1770,1732],{}," or a sibling selector. The checkbox is a real form control, so it is keyboard operable and announced by screen readers.",[14,1773,1774,1777],{},[42,1775,1776],{},"Do loading spinners need a pause control?","\nGenerally not. 2.2.2 exempts motion that is part of an activity where it is essential, and a loading indicator that stops when loading finishes communicates progress. A spinner that keeps running indefinitely, or decorative motion beside the loader, should still be addressed.",[34,1779,1781],{"id":1780},"related","Related",[1783,1784,1785,1791,1798,1805],"ul",{},[1786,1787,1788,1790],"li",{},[23,1789,26],{"href":25}," — the parent guide.",[1786,1792,1793,1797],{},[23,1794,1796],{"href":1795},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fvestibular-safe-animation-patterns\u002F","Vestibular-Safe Animation Patterns"," — which motion is most likely to cause harm.",[1786,1799,1800,1804],{},[23,1801,1803],{"href":1802},"\u002Fcss-only-micro-interactions-animations\u002Fcolor-and-theme-transitions\u002Fanimating-gradients\u002F","Animating CSS Gradients Smoothly"," — the drifting background paused here.",[1786,1806,1807,1811],{},[23,1808,1810],{"href":1809},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fscroll-driven-animation-fallbacks\u002F","Scroll-Driven Animation Fallbacks"," — motion that only runs when the user scrolls.",[322,1813,1814],{},"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 .soyes, html code.shiki .soyes{--shiki-default:#702C00;--shiki-dark:#FFB757}html pre.shiki code .sLBg1, html code.shiki .sLBg1{--shiki-default:#66707B;--shiki-dark:#BDC4CC}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":206,"searchDepth":230,"depth":230,"links":1816},[1817,1818,1819,1820,1821,1822,1823,1824],{"id":36,"depth":230,"text":37},{"id":191,"depth":230,"text":192},{"id":1439,"depth":230,"text":1440},{"id":1591,"depth":230,"text":1592},{"id":1619,"depth":230,"text":1620},{"id":1723,"depth":230,"text":1724},{"id":1743,"depth":230,"text":1744},{"id":1780,"depth":230,"text":1781},"Meet WCAG 2.2.2 Pause, Stop, Hide for looping CSS animations: a checkbox pause control with animation-play-state, self-stopping loops and reduced motion.","md",{"pageTitle":1828,"datePublished":1829,"dateModified":1829,"faq":1830},"Pause Controls for Looping CSS Animations","2026-09-18",[1831,1833,1836,1838],{"q":1749,"a":1832},"When moving, blinking or scrolling content starts automatically, lasts more than five seconds, and is presented in parallel with other content. A decorative looping animation beside an article meets all three conditions, so it needs a way to pause, stop or hide it.",{"q":1834,"a":1835},"Is honouring prefers-reduced-motion enough to meet 2.2.2?","No. The media query only helps users who have set the operating-system preference. 2.2.2 requires a mechanism on the page for everyone, including users who never found or changed that setting. Use both: stop motion by default for reduced-motion users and provide a visible pause control.",{"q":1764,"a":1837},"Yes. A checkbox with a clear label can toggle animation-play-state: paused on the animations through :has() or a sibling selector. The checkbox is a real form control, so it is keyboard operable and announced by screen readers.",{"q":1776,"a":1839},"Generally not. 2.2.2 exempts motion that is part of an activity where it is essential, and a loading indicator that stops when loading finishes communicates progress. A spinner that keeps running indefinitely, or decorative motion beside the loader, should still be addressed.","\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fpause-controls-for-looping-animations",{"title":5,"description":1825},"css-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fpause-controls-for-looping-animations\u002Findex","q53NhL7v6NZLocDIKl7EOP6euAbO6uac5NFWry2u3LI",[1845,1848,1851,1854,1857,1858,1861,1864,1867,1870,1873,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,2124,2127,2130,2133,2136,2139,2142,2145,2148,2151,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],{"path":1846,"title":1847},"\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":1849,"title":1850},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fflashing-content-and-seizure-thresholds","Flashing Content and Seizure Thresholds",{"path":1852,"title":1853},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fforced-colors-mode-and-animations","Forced Colors Mode and Animations",{"path":1855,"title":1856},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations","Accessibility in CSS Animations: Patterns, Specs & Best Practices",{"path":1840,"title":5},{"path":1859,"title":1860},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fprefers-reduced-motion-recipes","prefers-reduced-motion Recipes: A Reduction for Every Common Effect",{"path":1862,"title":1863},"\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":1865,"title":1866},"\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":1868,"title":1869},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fvestibular-safe-animation-patterns","Vestibular-Safe Animation Patterns: Why Some Motion Makes People Sick",{"path":1871,"title":1872},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fwcag-motion-success-criteria","WCAG Motion Success Criteria: What Each One Actually Requires",{"path":1874,"title":1875},"\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":1877,"title":1878},"\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":1880,"title":1881},"\u002Fcss-only-micro-interactions-animations\u002Fclip-path-and-mask-animations","Clip-Path & Mask Animations: Animating Visibility Instead of Position",{"path":1883,"title":1884},"\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":1886,"title":1887},"\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":1889,"title":1890},"\u002Fcss-only-micro-interactions-animations\u002Fcolor-and-theme-transitions\u002Fanimating-gradients","Animating CSS Gradients: Smooth Colour Motion Without Jumps",{"path":1892,"title":1893},"\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":1895,"title":1896},"\u002Fcss-only-micro-interactions-animations\u002Fcolor-and-theme-transitions","Color & Theme Transitions: Colour as Part of the Motion System",{"path":1898,"title":1899},"\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":1901,"title":1902},"\u002Fcss-only-micro-interactions-animations\u002Fcolor-and-theme-transitions\u002Fsmooth-theme-switching-transitions","Smooth Theme Switching: Crossfades, Circular Reveals and No Flash",{"path":1904,"title":1905},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion\u002Fcontainer-query-hover-affordances","Container Query Hover Affordances: When Narrow Means Persistent, Not Hidden",{"path":1907,"title":1908},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion","Container-Aware Motion: Animation Sized by the Space a Component Actually Has",{"path":1910,"title":1911},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion\u002Flayout-change-animations-at-container-breakpoints","Animating Changes at Container Breakpoints",{"path":1913,"title":1914},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion\u002Fmotion-driven-by-container-style-queries","Motion Driven by Container Style Queries",{"path":1916,"title":1917},"\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":1919,"title":1920},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion\u002Fsuppressing-motion-in-small-containers","Suppressing Motion in Small Containers: Deliberately Animating Nothing",{"path":1922,"title":1923},"\u002Fcss-only-micro-interactions-animations\u002Fcss-animation-vs-web-animations-api\u002Fcontrolling-css-animations-from-javascript","Controlling CSS Animations From JavaScript",{"path":1925,"title":1926},"\u002Fcss-only-micro-interactions-animations\u002Fcss-animation-vs-web-animations-api","CSS Animation vs the Web Animations API: A Decision Guide",{"path":1928,"title":1929},"\u002Fcss-only-micro-interactions-animations\u002Fcss-animation-vs-web-animations-api\u002Fwaapi-vs-css-for-interruptible-ui","Interruptible UI: CSS Transitions vs WAAPI",{"path":1931,"title":1932},"\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":1934,"title":1935},"\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":1937,"title":1938},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture\u002Fcustom-property-fallbacks-and-invalid-values","Custom Property Fallbacks and Invalid Values",{"path":1940,"title":1941},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture\u002Ffluid-spacing-tokens-driving-transition-durations","Fluid Spacing Tokens That Drive Transition Durations",{"path":1943,"title":1944},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture","CSS Custom Properties Architecture: Scalable Design Systems & Dynamic UI",{"path":1946,"title":1947},"\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":1949,"title":1950},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture\u002Fscoping-custom-properties-to-components","Scoping Custom Properties to Components",{"path":1952,"title":1953},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Fcss-transition-timing-functions","CSS Transition Timing Functions: ease, cubic-bezier(), steps() and linear()",{"path":1955,"title":1956},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals","CSS Transition Fundamentals: Architecture, Performance & Patterns",{"path":1958,"title":1959},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Finterrupted-and-reversing-transitions","Interrupted and Reversing Transitions: What Happens Mid-Flight",{"path":1961,"title":1962},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Fstarting-style-entry-animations","@starting-style: Animating an Element's Very First Style Change",{"path":1964,"title":1965},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Ftransition-delay-choreography","Choreographing Motion With transition-delay",{"path":1967,"title":1968},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Ftransition-shorthand-and-multiple-properties","The transition Shorthand and Multiple Properties",{"path":1970,"title":1971},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Ftransitioning-display-with-allow-discrete","Transitioning display with transition-behavior: allow-discrete and @starting-style",{"path":1973,"title":1974},"\u002Fcss-only-micro-interactions-animations\u002Fdialog-and-popover-animations\u002Fanimating-dialog-open-and-close","Animating \u003Cdialog> Open and Close: Both Directions, No Library",{"path":1976,"title":1977},"\u002Fcss-only-micro-interactions-animations\u002Fdialog-and-popover-animations\u002Fbackdrop-animations","Animating ::backdrop: Fades and Blurs Behind Dialogs and Popovers",{"path":1979,"title":1980},"\u002Fcss-only-micro-interactions-animations\u002Fdialog-and-popover-animations","Dialog & Popover Animations: Motion for the Top Layer",{"path":1982,"title":1983},"\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":1985,"title":1986},"\u002Fcss-only-micro-interactions-animations\u002Fdialog-and-popover-animations\u002Fpopover-entry-and-exit-transitions","Popover Menus That Animate From Their Anchor",{"path":1988,"title":1989},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design\u002Fchoosing-animation-durations","Choosing Animation Durations: How Long Motion Should Last",{"path":1991,"title":1992},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design\u002Fcubic-bezier-overshoot-and-anticipation","Overshoot and Anticipation With cubic-bezier(): Motion With Character",{"path":1994,"title":1995},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design\u002Fentry-vs-exit-easing","Entry vs Exit Easing: Different Curves for Arriving and Leaving",{"path":1997,"title":1998},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design","Easing & Motion Design: Making CSS Motion Feel Intentional",{"path":2000,"title":2001},"\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":2003,"title":2004},"\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":2006,"title":2007},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design\u002Faccessible-css-only-tooltips","Accessible CSS-Only Tooltips and Hover Cards With  and ",{"path":2009,"title":2010},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design\u002Fbutton-press-and-active-states","Button Press and  States",{"path":2012,"title":2013},"\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":2015,"title":2016},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design\u002Ffocus-within-form-patterns"," Form Patterns: Styling a Group From the Field Inside It",{"path":2018,"title":2019},"\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":2021,"title":2022},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design","Hover & Focus State Design: Spec-Compliant Patterns for Modern UIs",{"path":2024,"title":2025},"\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":2027,"title":2028},"\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":2030,"title":2031},"\u002Fcss-only-micro-interactions-animations","CSS-Only Micro-Interactions & Animations: Architecture, Performance & Implementation",{"path":2033,"title":2034},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fanimation-composition-and-stacking","Stacking Animations With animation-composition",{"path":2036,"title":2037},"\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":2039,"title":2040},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fcontainer-query-triggered-keyframe-animations","Container-Query-Triggered Keyframe Animations: Animate Differently per Available Space",{"path":2042,"title":2043},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fcss-only-accordions-and-disclosure","CSS-Only Accordions and Disclosure Widgets with details and summary",{"path":2045,"title":2046},"\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":2048,"title":2049},"\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":2051,"title":2052},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns","Keyframe Animation Patterns: Spec-Compliant Architectures for Modern UIs",{"path":2054,"title":2055},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fmulti-step-keyframes-and-per-keyframe-easing","Multi-Step Keyframes and Per-Keyframe Easing",{"path":2057,"title":2058},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fstaggered-list-animations-with-custom-properties","Staggered List Animations Using --i Index Custom Properties",{"path":2060,"title":2061},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Fanimating-box-shadow-and-filters-cheaply","Animating box-shadow and Filters Cheaply",{"path":2063,"title":2064},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Fcontain-property-for-animation-performance","The contain Property for Animation Performance",{"path":2066,"title":2067},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Fcss-triggers-layout-paint-composite","Layout, Paint and Composite: What Triggers What",{"path":2069,"title":2070},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration","Performance & GPU Acceleration in CSS: A Developer’s Blueprint",{"path":2072,"title":2073},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Foptimizing-css-animations-for-60fps","Optimizing CSS Animations for 60fps: Budgeting the Frame",{"path":2075,"title":2076},"\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":2078,"title":2079},"\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":2081,"title":2082},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations","Scroll-Driven Animations: Binding Motion to Scroll Position in Pure CSS",{"path":2084,"title":2085},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fscroll-driven-animation-fallbacks","Shipping Scroll-Driven Animations Without Breaking Anything",{"path":2087,"title":2088},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fscroll-driven-parallax-effects","Scroll-Driven Parallax Effects in CSS",{"path":2090,"title":2091},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fscroll-progress-bar-without-javascript","A Reading Progress Bar Driven by scroll(root)",{"path":2093,"title":2094},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fscroll-triggered-reveal-animations","Reveal-on-Scroll with view() and animation-range",{"path":2096,"title":2097},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Ftimeline-scope-for-cross-element-animations","timeline-scope for Cross-Element Animations",{"path":2099,"title":2100},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fview-timeline-and-animation-range","View Timelines and animation-range",{"path":2102,"title":2103},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fcross-document-view-transitions","Cross-Document View Transitions",{"path":2105,"title":2106},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers","View Transitions for CSS Developers: the Pseudo-Element Tree, Snapshots, and Named Elements",{"path":2108,"title":2109},"\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":2111,"title":2112},"\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":2114,"title":2115},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fview-transition-types-and-classes","View Transition Types and Classes",{"path":2117,"title":2118},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fview-transitions-for-list-reordering","View Transitions for List Reordering",{"path":2120,"title":2121},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fview-transitions-with-reduced-motion","Honouring prefers-reduced-motion in View Transitions",{"path":349,"title":2123},"Modern CSS Layouts & Micro-Interactions",{"path":2125,"title":2126},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fanchor-positioned-tooltips","Anchor-Positioned Tooltips: Tethering, Flipping, and Getting the Semantics Right",{"path":2128,"title":2129},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fanchor-positioning-fallbacks","Anchor Positioning Fallbacks: A Graceful Floor for Older Browser Versions",{"path":2131,"title":2132},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fanchor-size-for-matching-widths","anchor-size(): Overlays That Match Their Trigger's Size",{"path":2134,"title":2135},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays","CSS Anchor Positioning and Overlays: Tethering Elements Without JavaScript",{"path":2137,"title":2138},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fpopover-attribute-and-css-styling","The popover Attribute: Top-Layer Overlays With No JavaScript",{"path":2140,"title":2141},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fpopover-light-dismiss-and-stacking","Popover Light Dismiss, Nesting and Stacking",{"path":2143,"title":2144},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fposition-area-grid-explained","position-area: The Anchor Placement Grid",{"path":2146,"title":2147},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Fcontainer-query-polyfill-tradeoffs","Container Query Polyfills: What They Cost and When to Skip Them",{"path":2149,"title":2150},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Ffeature-detection-with-supports","Feature Detection with @supports: Syntax, Semantics, and the Traps",{"path":2152,"title":2153},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Fhandling-container-query-fallbacks-for-older-browsers","Handling Container Query Fallbacks for Older Browsers",{"path":2155,"title":2156},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks","Container Query Fallbacks: Spec-Compliant CSS Strategies for Legacy Browsers",{"path":2158,"title":2159},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Fintrinsic-layout-fallbacks-without-queries","Intrinsic Layout Fallbacks: Baselines That Adapt Without Any Query",{"path":2161,"title":2162},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Ftesting-fallbacks-without-old-browsers","Testing CSS Fallbacks Without an Old Browser",{"path":2164,"title":2165},"\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":2167,"title":2168},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fcontainer-query-range-and-logic-operators","Container Query Range Syntax and Logic Operators",{"path":2170,"title":2171},"\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":2173,"title":2174},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fcontainer-type-size-vs-inline-size","Choosing container-type: inline-size, size, or normal",{"path":2176,"title":2177},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fcontainer-vs-media-queries-comparison","Container vs Media Queries: Choosing the Right Reference Box",{"path":2179,"title":2180},"\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":2182,"title":2183},"\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":2185,"title":2186},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics","Container Query Syntax Basics",{"path":2188,"title":2189},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fnesting-and-naming-container-queries","Nesting and Naming Container Queries: Targeting the Right Ancestor",{"path":2191,"title":2192},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fauto-fit-minmax-responsive-grids","Responsive Grids with repeat(auto-fit, minmax())",{"path":2194,"title":2195},"\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":2197,"title":2198},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fgrid-auto-flow-dense-packing","grid-auto-flow: dense for Packed Layouts",{"path":2200,"title":2201},"\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":2203,"title":2204},"\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":2206,"title":2207},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts","CSS Grid and Subgrid Layouts for Responsive Interfaces",{"path":2209,"title":2210},"\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":2212,"title":2213},"\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":2215,"title":2216},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fsubgrid-vs-nested-grid","Subgrid vs an Independently Nested Grid",{"path":2218,"title":2219},"\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":2221,"title":2222},"\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":2224,"title":2225},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fflex-grow-and-flex-shrink-explained","flex-grow and flex-shrink Explained",{"path":2227,"title":2228},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fflex-wrap-intrinsic-responsive-rows","Breakpoint-Free Responsive Rows With flex-wrap and flex-basis",{"path":2230,"title":2231},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fflexbox-gap-and-spacing","Flexbox gap vs Margins: Spacing Items Without Edge Hacks",{"path":2233,"title":2234},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns","Flexbox Layout Patterns: One-Dimensional Layout for Real Components",{"path":2236,"title":2237},"\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":2239,"title":2240},"\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":2242,"title":2243},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp\u002Fdebugging-clamp-values","Debugging clamp(): Values That Are Ignored, Stuck or Never Fluid",{"path":2245,"title":2246},"\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":2248,"title":2249},"\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":2251,"title":2252},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp\u002Ffluid-type-accessibility-and-zoom","Fluid Type, Accessibility and Zoom: The vw-Only Trap",{"path":2254,"title":2255},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp\u002Ffluid-typography-without-javascript","Fluid Typography Without JavaScript: A Precision CSS Reference",{"path":2257,"title":2258},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp","Fluid Typography with clamp(): A Practical Guide for Modern CSS",{"path":2260,"title":2261},"\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":2263,"title":2264},"\u002Fmastering-container-queries-responsive-layouts","Mastering Container Queries & Responsive Layouts",{"path":2266,"title":2267},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Faspect-ratio-for-responsive-media","Using aspect-ratio for Responsive Media and Preventing Layout Shift",{"path":2269,"title":2270},"\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":2272,"title":2273},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques","Intrinsic Sizing Techniques: Modern CSS Layouts for Responsive UI",{"path":2275,"title":2276},"\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":2278,"title":2279},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Fmin-max-fit-content-explained","min-content, max-content, and fit-content() Explained",{"path":2281,"title":2282},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Fobject-fit-and-object-position","object-fit and object-position: Images That Fit Any Box",{"path":2284,"title":2285},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Fpreventing-flex-and-grid-overflow","The min-width: auto Trap in Flex and Grid Layouts",{"path":2287,"title":2288},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies\u002Fcascade-layers-for-reset-and-tokens","Cascade Layers for Reset and Design Tokens",{"path":2290,"title":2291},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies\u002Fcascade-layers-vs-specificity-hacks","Cascade Layers vs Specificity Hacks: Ordering Instead of Escalating",{"path":2293,"title":2294},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies\u002Fcss-scope-for-component-styles","@scope for Component Styles: Short Selectors That Cannot Leak",{"path":2296,"title":2297},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies","Modern CSS Reset Strategies: A Spec-Compliant Foundation",{"path":2299,"title":2300},"\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":2302,"title":2303},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies\u002Fwriting-a-minimal-modern-reset","Writing a Minimal Modern CSS Reset: Every Line Justified",{"path":2305,"title":2306},"\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":2308,"title":2309},"\u002Fmastering-container-queries-responsive-layouts\u002Fparent-aware-layouts-with-has\u002Fempty-and-loading-states-with-has","Empty and Loading States With ()",{"path":2311,"title":2312},"\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":2314,"title":2315},"\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":2317,"title":2318},"\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":2320,"title":2321},"\u002Fmastering-container-queries-responsive-layouts\u002Fparent-aware-layouts-with-has","Parent-Aware Layouts With :has(): Letting Containers React to Their Contents",{"path":2323,"title":2324},"\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":2326,"title":2327},"\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":2329,"title":2330},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fcontainer-query-data-tables","Container Query Data Tables: Reflowing Tables to Cards",{"path":2332,"title":2333},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fcontainer-query-sidebar-layouts","Container Query Sidebar Layouts That Travel Between Contexts",{"path":2335,"title":2336},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns","Responsive Component Patterns: Architecture & Implementation",{"path":2338,"title":2339},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fresponsive-forms-with-container-queries","Responsive Forms with Container Queries: Reflow Without Losing the Wiring",{"path":2341,"title":2342},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fresponsive-hero-sections-with-container-queries","Responsive Hero Sections With Container Queries",{"path":2344,"title":2345},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fresponsive-navigation-without-media-queries","Responsive Navigation Without Media Queries Using Container Queries",{"path":2347,"title":2348},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fresponsive-pricing-tables","Responsive Pricing Tables: Aligned Features, a Clear Recommendation, Any Width",{"path":2350,"title":2351},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Ftabs-that-become-accordions","Tabs That Become an Accordion: One Component, Two Layouts",{"path":2353,"title":2354},"\u002Fmastering-container-queries-responsive-layouts\u002Fscroll-snap-and-overflow-layouts\u002Fcss-only-carousel-with-scroll-snap","A CSS-Only Carousel With Scroll Snap",{"path":2356,"title":2357},"\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":2359,"title":2360},"\u002Fmastering-container-queries-responsive-layouts\u002Fscroll-snap-and-overflow-layouts","Scroll Snap & Overflow Layouts: Designing Components That Scroll on Purpose",{"path":2362,"title":2363},"\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":2365,"title":2366},"\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":2368,"title":2369},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state\u002Fcombining-size-and-style-queries","Combining Size and Style Container Queries",{"path":2371,"title":2372},"\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":2374,"title":2375},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state","Style Queries and Container State: Token-Driven Component Variants",{"path":2377,"title":2378},"\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":2380,"title":2381},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state\u002Fstyle-query-component-variants","Component Variants With Style Queries: One Token, Many Looks",{"path":2383,"title":2384},"\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":2386,"title":2387},"\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":2389,"title":2390},"\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":2392,"title":2393},"\u002Fmastering-container-queries-responsive-layouts\u002Fviewport-units-and-mobile-layout","Viewport Units & Mobile Layout: Designing for the Screen You Actually Get",{"path":2395,"title":2396},"\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":2398,"title":2399},"\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":2401,"title":2402},"\u002Fmastering-container-queries-responsive-layouts\u002Fviewport-units-and-mobile-layout\u002Fvirtual-keyboard-and-interactive-widget","Layouts That Survive the Virtual Keyboard",{"title":2404,"caption":2405,"height":2406,"html":2407,"css":2408},"One checkbox pausing every looping animation","Tick the box to freeze the drifting background and the pulsing badge; untick to resume from the same frame.",240,"\n\u003Cheader class=\"hero\">\n  \u003Clabel class=\"motion-toggle\">\n    \u003Cinput type=\"checkbox\" id=\"pause-motion\">\n    \u003Cspan class=\"label-default\">Pause animation\u003C\u002Fspan>\n    \u003Cspan class=\"label-reduced\">Play animation\u003C\u002Fspan>\n  \u003C\u002Flabel>\n  \u003Ch1>Release 4.2\u003C\u002Fh1>\n  \u003Cp class=\"live\">Live now\u003C\u002Fp>\n\u003C\u002Fheader>","\nbody { display: block; padding: 0; }\n.hero { position: relative; min-height: 100vh; padding: 3rem 1.5rem 1.5rem; overflow: hidden; background: linear-gradient(120deg, #312e81, #1e3a8a, #0f766e); background-size: 300% 300%; color: #f8fafc; animation: drift 14s ease-in-out infinite alternate; }\n.hero h1 { margin: 0 0 0.5rem; }\n@keyframes drift { to { background-position: 100% 50%; } }\n.live { display: inline-flex; align-items: center; gap: 0.4rem; margin: 0; }\n.live::before { content: \"\"; width: 0.6rem; height: 0.6rem; border-radius: 50%; background: #f87171; animation: pulse 1.6s ease-in-out infinite; }\n@keyframes pulse { 50% { opacity: 0.35; scale: 0.8; } }\n.motion-toggle { position: absolute; top: 0.75rem; right: 0.75rem; display: inline-flex; gap: 0.4rem; align-items: center; padding: 0.3rem 0.6rem; border-radius: 6px; background: rgb(15 23 42 \u002F 0.6); font-size: 0.85rem; }\n.motion-toggle input:focus-visible { outline: 2px solid #f8fafc; outline-offset: 2px; }\n:root:has(#pause-motion:checked) .hero, :root:has(#pause-motion:checked) .live::before { animation-play-state: paused; }\n@media (prefers-reduced-motion: reduce) {\n  .hero, .live::before { animation-play-state: paused; }\n  :root:has(#pause-motion:checked) .hero, :root:has(#pause-motion:checked) .live::before { animation-play-state: running; }\n  .motion-toggle .label-default { display: none; }\n}\n@media (prefers-reduced-motion: no-preference) { .motion-toggle .label-reduced { display: none; } }",1789717748008]