[{"data":1,"prerenderedAt":2282},["ShallowReactive",2],{"page-\u002Fcss-only-micro-interactions-animations\u002Fcolor-and-theme-transitions\u002Flight-dark-function-for-themes":3,"content-all-pages":1717,"live-demo:light-dark-tokens":2276},{"id":4,"title":5,"body":6,"description":1695,"extension":1696,"meta":1697,"navigation":409,"path":1713,"seo":1714,"stem":1715,"__hash__":1716},"content\u002Fcss-only-micro-interactions-animations\u002Fcolor-and-theme-transitions\u002Flight-dark-function-for-themes\u002Findex.md","Light and Dark Themes With light-dark(): One Declaration per Colour",{"type":7,"value":8,"toc":1683},"minimark",[9,19,60,65,68,79,83,192,219,223,233,237,1103,1113,1226,1230,1260,1312,1337,1341,1347,1366,1383,1387,1393,1403,1407,1423,1533,1540,1544,1565,1569,1591,1624,1633,1648,1652,1680],[10,11,13,14,18],"h1",{"id":12},"light-and-dark-themes-with-light-dark-one-declaration-per-colour","Light and Dark Themes With ",[15,16,17],"code",{},"light-dark()",": One Declaration per Colour",[20,21,22,23,26,27,30,31,34,35,37,38,41,42,45,46,48,49,54,55,59],"p",{},"The traditional way to ship light and dark themes is two blocks of custom properties: one on ",[15,24,25],{},":root",", one in ",[15,28,29],{},"@media (prefers-color-scheme: dark)"," or under ",[15,32,33],{},"[data-theme=\"dark\"]",". Every token appears twice, far apart in the stylesheet, and adding a colour means remembering to add it in both places. The ",[15,36,17],{}," function collapses each pair into one declaration: ",[15,39,40],{},"--surface: light-dark(#ffffff, #0f172a)",". Combined with the ",[15,43,44],{},"color-scheme"," property, it lets a single rule decide which half applies, whether the choice comes from the operating system or a theme toggle. This page shows how the two fit together, how to wire a manual toggle, and the traps that make ",[15,47,17],{}," appear not to work. It is part of ",[50,51,53],"a",{"href":52},"\u002Fcss-only-micro-interactions-animations\u002Fcolor-and-theme-transitions\u002F","Color & Theme Transitions"," in the ",[50,56,58],{"href":57},"\u002Fcss-only-micro-interactions-animations\u002F","CSS-Only Micro-Interactions & Animations"," guide.",[61,62,64],"h2",{"id":63},"why-pair-the-colours","Why pair the colours",[20,66,67],{},"A theme is a mapping from roles to colours. The role \"surface\" is white in light mode and near-black in dark mode; the role \"muted text\" is slate-600 in one and slate-400 in the other. Keeping both values of a role together makes the relationship reviewable at a glance — you can see that the dark muted text is lighter than the light one and judge whether its contrast is comparable. Splitting them across two blocks hides the relationship and invites drift: a token updated in the light block and forgotten in the dark one is the classic source of an unreadable dark mode.",[20,69,70,72,73,75,76,78],{},[15,71,17],{}," also removes a category of bug. With two override blocks, the dark theme depends on a media query or attribute being matched in the right place with the right specificity. With ",[15,74,17],{},", the decision is made by ",[15,77,44],{},", a single inherited property, so there is one switch to get right.",[61,80,82],{"id":81},"how-the-decision-is-made","How the decision is made",[84,85,91,92,91,96,91,100,91,108,91,120,91,126,91,131,91,134,91,136,91,139,91,144,91,148,91,154,91,158,91,164,91,168,91,173,91,177,91,179,91,182,91,189],"svg",{"viewBox":86,"role":87,"ariaLabel":88,"xmlns":89,"style":90},"0 0 720 320","img","Flow from the operating system preference and the color-scheme property to the used colour scheme, which light-dark() reads to pick its first or second argument","http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg","width:100%;height:auto;max-width:720px;margin:2rem 0","\n  ",[93,94,95],"title",{},"From color-scheme to a colour",[97,98,99],"desc",{},"color-scheme on the root, inherited by descendants, declares which schemes the element supports. If it is light dark, the operating-system preference chooses. If it is light or dark alone, that scheme is used. light-dark() then returns its first argument for light and second for dark.",[101,102,107],"text",{"textAnchor":103,"x":104,"y":105,"style":106},"middle","360","26","text-anchor:middle;fill:currentColor;font:700 17px sans-serif","color-scheme chooses; light-dark() reads the choice",[109,110],"rect",{"x":111,"y":112,"width":113,"height":114,"rx":115,"fill":116,"stroke":117,"strokeWidth":118,"opacity":119},"30","56","200","80","10","none","currentColor","1.5","0.6",[101,121,125],{"textAnchor":103,"x":122,"y":123,"style":124},"130","86","text-anchor:middle;fill:currentColor;font:700 13px sans-serif","OS preference",[101,127,130],{"textAnchor":103,"x":122,"y":128,"style":129},"110","text-anchor:middle;fill:currentColor;font:12px ui-monospace,monospace","prefers-color-scheme",[109,132],{"x":133,"y":112,"width":113,"height":114,"rx":115,"fill":116,"stroke":117,"strokeWidth":118,"opacity":119},"260",[101,135,44],{"textAnchor":103,"x":104,"y":123,"style":124},[101,137,138],{"textAnchor":103,"x":104,"y":128,"style":129},"light dark | light | dark",[140,141],"line",{"x1":142,"y1":143,"x2":133,"y2":143,"stroke":117,"strokeWidth":118,"opacity":119},"230","96",[140,145],{"x1":104,"y1":146,"x2":104,"y2":147,"stroke":117,"strokeWidth":118,"opacity":119},"136","166",[109,149],{"x":150,"y":147,"width":150,"height":151,"rx":115,"fill":152,"opacity":153},"240","50","#7aa2ff","0.3",[101,155,157],{"textAnchor":103,"x":104,"y":156,"style":124},"196","used scheme: light or dark",[140,159],{"x1":160,"y1":161,"x2":162,"y2":163,"stroke":117,"strokeWidth":118,"opacity":119},"300","216","170","250",[140,165],{"x1":166,"y1":161,"x2":167,"y2":163,"stroke":117,"strokeWidth":118,"opacity":119},"420","550",[109,169],{"x":170,"y":163,"width":133,"height":171,"rx":115,"fill":152,"opacity":172},"40","46","0.18",[101,174,176],{"textAnchor":103,"x":162,"y":175,"style":129},"278","light-dark(FIRST, second)",[109,178],{"x":166,"y":163,"width":133,"height":171,"rx":115,"fill":152,"opacity":172},[101,180,181],{"textAnchor":103,"x":167,"y":175,"style":129},"light-dark(first, SECOND)",[101,183,188],{"textAnchor":184,"x":185,"y":186,"style":187},"start","500","60","text-anchor:start;fill:currentColor;font:12px sans-serif","inherits down",[101,190,191],{"textAnchor":184,"x":185,"y":114,"style":187},"the tree",[20,193,194,196,197,201,202,204,205,208,209,212,213,215,216,218],{},[15,195,44],{}," has two jobs. It tells the browser which schemes the page supports, which also themes form controls, scrollbars and the default canvas colour. And it determines the ",[198,199,200],"em",{},"used"," scheme for each element, which is what ",[15,203,17],{}," consults. With ",[15,206,207],{},"color-scheme: light dark",", the operating-system preference picks; with ",[15,210,211],{},"color-scheme: dark",", dark is used regardless of the preference. Because ",[15,214,44],{}," inherits, setting it on ",[15,217,25],{}," covers the page, and setting it on a subtree creates a locally themed region.",[61,220,222],{"id":221},"the-complete-implementation","The complete implementation",[20,224,225,226,228,229,232],{},"The page below defines tokens with ",[15,227,17],{},", follows the system preference by default, and lets a toggle override it by setting ",[15,230,231],{},"data-theme"," on the root.",[234,235],"live-demo",{"name":236},"light-dark-tokens",[238,239,244],"pre",{"className":240,"code":241,"language":242,"meta":243,"style":243},"language-html shiki shiki-themes github-light-high-contrast github-dark-high-contrast","\u003C!doctype html>\n\u003Chtml lang=\"en\" data-theme=\"system\">\n\u003Chead>\n\u003Cmeta charset=\"utf-8\">\n\u003Cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n\u003Ctitle>light-dark() themes\u003C\u002Ftitle>\n\u003Cstyle>\n  :root {\n    \u002F* Default: follow the operating system. *\u002F\n    color-scheme: light dark;\n\n    \u002F* Each token declared once, both themes side by side. *\u002F\n    --surface:      light-dark(#ffffff, #0f172a);\n    --surface-alt:  light-dark(#f1f5f9, #1e293b);\n    --text:         light-dark(#0f172a, #e2e8f0);\n    --text-muted:   light-dark(#475569, #94a3b8);\n    --border:       light-dark(#cbd5e1, #334155);\n    --accent:       light-dark(#4338ca, #a5b4fc);\n  }\n\n  \u002F* A manual choice overrides the system by pinning color-scheme. *\u002F\n  :root[data-theme=\"light\"] { color-scheme: light; }\n  :root[data-theme=\"dark\"]  { color-scheme: dark; }\n\n  body {\n    margin: 0;\n    padding: 1.5rem;\n    background: var(--surface);\n    color: var(--text);\n    font: 16px\u002F1.6 system-ui, sans-serif;\n  }\n\n  .card {\n    max-width: 26rem;\n    padding: 1.25rem;\n    border: 1px solid var(--border);\n    border-radius: 12px;\n    background: var(--surface-alt);\n  }\n  .card p { color: var(--text-muted); }\n  .card a { color: var(--accent); }\n\n  \u002F* A permanently dark region inside any theme, e.g. a code sample. *\u002F\n  .code-panel {\n    color-scheme: dark;\n    background: var(--surface);\n    color: var(--text);\n    padding: 1rem;\n    border-radius: 8px;\n  }\n\u003C\u002Fstyle>\n\u003C\u002Fhead>\n\u003Cbody>\n  \u003Cdiv class=\"card\">\n    \u003Ch2>Invoice #1042\u003C\u002Fh2>\n    \u003Cp>Due in 14 days. \u003Ca href=\"\u002Finvoices\u002F1042\u002F\">View details\u003C\u002Fa>\u003C\u002Fp>\n    \u003Cpre class=\"code-panel\">amount: 240.00\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fbody>\n\u003C\u002Fhtml>\n","html","",[15,245,246,265,293,303,321,346,360,370,379,386,404,411,417,439,458,476,495,514,532,538,543,549,577,603,608,616,629,644,663,680,710,715,720,728,742,756,782,797,813,818,844,867,872,878,886,897,912,927,940,954,959,969,978,988,1007,1022,1054,1075,1085,1094],{"__ignoreMap":243},[247,248,250,254,258,262],"span",{"class":140,"line":249},1,[247,251,253],{"class":252},"suds8","\u003C!",[247,255,257],{"class":256},"sne4z","doctype",[247,259,261],{"class":260},"s-5SL"," html",[247,263,264],{"class":252},">\n",[247,266,268,271,273,276,279,283,286,288,291],{"class":140,"line":267},2,[247,269,270],{"class":252},"\u003C",[247,272,242],{"class":256},[247,274,275],{"class":260}," lang",[247,277,278],{"class":252},"=",[247,280,282],{"class":281},"sT6z2","\"en\"",[247,284,285],{"class":260}," data-theme",[247,287,278],{"class":252},[247,289,290],{"class":281},"\"system\"",[247,292,264],{"class":252},[247,294,296,298,301],{"class":140,"line":295},3,[247,297,270],{"class":252},[247,299,300],{"class":256},"head",[247,302,264],{"class":252},[247,304,306,308,311,314,316,319],{"class":140,"line":305},4,[247,307,270],{"class":252},[247,309,310],{"class":256},"meta",[247,312,313],{"class":260}," charset",[247,315,278],{"class":252},[247,317,318],{"class":281},"\"utf-8\"",[247,320,264],{"class":252},[247,322,324,326,328,331,333,336,339,341,344],{"class":140,"line":323},5,[247,325,270],{"class":252},[247,327,310],{"class":256},[247,329,330],{"class":260}," name",[247,332,278],{"class":252},[247,334,335],{"class":281},"\"viewport\"",[247,337,338],{"class":260}," content",[247,340,278],{"class":252},[247,342,343],{"class":281},"\"width=device-width, initial-scale=1\"",[247,345,264],{"class":252},[247,347,349,351,353,356,358],{"class":140,"line":348},6,[247,350,270],{"class":252},[247,352,93],{"class":256},[247,354,355],{"class":252},">light-dark() themes\u003C\u002F",[247,357,93],{"class":256},[247,359,264],{"class":252},[247,361,363,365,368],{"class":140,"line":362},7,[247,364,270],{"class":252},[247,366,367],{"class":256},"style",[247,369,264],{"class":252},[247,371,373,376],{"class":140,"line":372},8,[247,374,375],{"class":260},"  :root",[247,377,378],{"class":252}," {\n",[247,380,382],{"class":140,"line":381},9,[247,383,385],{"class":384},"sLBg1","    \u002F* Default: follow the operating system. *\u002F\n",[247,387,389,392,395,398,401],{"class":140,"line":388},10,[247,390,391],{"class":260},"    color-scheme",[247,393,394],{"class":252},": ",[247,396,397],{"class":260},"light",[247,399,400],{"class":260}," dark",[247,402,403],{"class":252},";\n",[247,405,407],{"class":140,"line":406},11,[247,408,410],{"emptyLinePlaceholder":409},true,"\n",[247,412,414],{"class":140,"line":413},12,[247,415,416],{"class":384},"    \u002F* Each token declared once, both themes side by side. *\u002F\n",[247,418,420,424,427,430,433,436],{"class":140,"line":419},13,[247,421,423],{"class":422},"soyes","    --surface",[247,425,426],{"class":252},":      light-dark(",[247,428,429],{"class":260},"#ffffff",[247,431,432],{"class":252},", ",[247,434,435],{"class":260},"#0f172a",[247,437,438],{"class":252},");\n",[247,440,442,445,448,451,453,456],{"class":140,"line":441},14,[247,443,444],{"class":422},"    --surface-alt",[247,446,447],{"class":252},":  light-dark(",[247,449,450],{"class":260},"#f1f5f9",[247,452,432],{"class":252},[247,454,455],{"class":260},"#1e293b",[247,457,438],{"class":252},[247,459,461,464,467,469,471,474],{"class":140,"line":460},15,[247,462,463],{"class":422},"    --text",[247,465,466],{"class":252},":         light-dark(",[247,468,435],{"class":260},[247,470,432],{"class":252},[247,472,473],{"class":260},"#e2e8f0",[247,475,438],{"class":252},[247,477,479,482,485,488,490,493],{"class":140,"line":478},16,[247,480,481],{"class":422},"    --text-muted",[247,483,484],{"class":252},":   light-dark(",[247,486,487],{"class":260},"#475569",[247,489,432],{"class":252},[247,491,492],{"class":260},"#94a3b8",[247,494,438],{"class":252},[247,496,498,501,504,507,509,512],{"class":140,"line":497},17,[247,499,500],{"class":422},"    --border",[247,502,503],{"class":252},":       light-dark(",[247,505,506],{"class":260},"#cbd5e1",[247,508,432],{"class":252},[247,510,511],{"class":260},"#334155",[247,513,438],{"class":252},[247,515,517,520,522,525,527,530],{"class":140,"line":516},18,[247,518,519],{"class":422},"    --accent",[247,521,503],{"class":252},[247,523,524],{"class":260},"#4338ca",[247,526,432],{"class":252},[247,528,529],{"class":260},"#a5b4fc",[247,531,438],{"class":252},[247,533,535],{"class":140,"line":534},19,[247,536,537],{"class":252},"  }\n",[247,539,541],{"class":140,"line":540},20,[247,542,410],{"emptyLinePlaceholder":409},[247,544,546],{"class":140,"line":545},21,[247,547,548],{"class":384},"  \u002F* A manual choice overrides the system by pinning color-scheme. *\u002F\n",[247,550,552,554,557,559,562,565,568,570,572,574],{"class":140,"line":551},22,[247,553,375],{"class":260},[247,555,556],{"class":252},"[",[247,558,231],{"class":260},[247,560,278],{"class":561},"sHUrx",[247,563,564],{"class":281},"\"light\"",[247,566,567],{"class":252},"] { ",[247,569,44],{"class":260},[247,571,394],{"class":252},[247,573,397],{"class":260},[247,575,576],{"class":252},"; }\n",[247,578,580,582,584,586,588,591,594,596,598,601],{"class":140,"line":579},23,[247,581,375],{"class":260},[247,583,556],{"class":252},[247,585,231],{"class":260},[247,587,278],{"class":561},[247,589,590],{"class":281},"\"dark\"",[247,592,593],{"class":252},"]  { ",[247,595,44],{"class":260},[247,597,394],{"class":252},[247,599,600],{"class":260},"dark",[247,602,576],{"class":252},[247,604,606],{"class":140,"line":605},24,[247,607,410],{"emptyLinePlaceholder":409},[247,609,611,614],{"class":140,"line":610},25,[247,612,613],{"class":256},"  body",[247,615,378],{"class":252},[247,617,619,622,624,627],{"class":140,"line":618},26,[247,620,621],{"class":260},"    margin",[247,623,394],{"class":252},[247,625,626],{"class":260},"0",[247,628,403],{"class":252},[247,630,632,635,637,639,642],{"class":140,"line":631},27,[247,633,634],{"class":260},"    padding",[247,636,394],{"class":252},[247,638,118],{"class":260},[247,640,641],{"class":561},"rem",[247,643,403],{"class":252},[247,645,647,650,652,655,658,661],{"class":140,"line":646},28,[247,648,649],{"class":260},"    background",[247,651,394],{"class":252},[247,653,654],{"class":260},"var",[247,656,657],{"class":252},"(",[247,659,660],{"class":422},"--surface",[247,662,438],{"class":252},[247,664,666,669,671,673,675,678],{"class":140,"line":665},29,[247,667,668],{"class":260},"    color",[247,670,394],{"class":252},[247,672,654],{"class":260},[247,674,657],{"class":252},[247,676,677],{"class":422},"--text",[247,679,438],{"class":252},[247,681,683,686,688,691,694,697,700,703,705,708],{"class":140,"line":682},30,[247,684,685],{"class":260},"    font",[247,687,394],{"class":252},[247,689,690],{"class":260},"16",[247,692,693],{"class":561},"px",[247,695,696],{"class":252},"\u002F",[247,698,699],{"class":260},"1.6",[247,701,702],{"class":260}," system-ui",[247,704,432],{"class":252},[247,706,707],{"class":260},"sans-serif",[247,709,403],{"class":252},[247,711,713],{"class":140,"line":712},31,[247,714,537],{"class":252},[247,716,718],{"class":140,"line":717},32,[247,719,410],{"emptyLinePlaceholder":409},[247,721,723,726],{"class":140,"line":722},33,[247,724,725],{"class":260},"  .card",[247,727,378],{"class":252},[247,729,731,734,736,738,740],{"class":140,"line":730},34,[247,732,733],{"class":260},"    max-width",[247,735,394],{"class":252},[247,737,105],{"class":260},[247,739,641],{"class":561},[247,741,403],{"class":252},[247,743,745,747,749,752,754],{"class":140,"line":744},35,[247,746,634],{"class":260},[247,748,394],{"class":252},[247,750,751],{"class":260},"1.25",[247,753,641],{"class":561},[247,755,403],{"class":252},[247,757,759,762,764,767,769,772,775,777,780],{"class":140,"line":758},36,[247,760,761],{"class":260},"    border",[247,763,394],{"class":252},[247,765,766],{"class":260},"1",[247,768,693],{"class":561},[247,770,771],{"class":260}," solid",[247,773,774],{"class":260}," var",[247,776,657],{"class":252},[247,778,779],{"class":422},"--border",[247,781,438],{"class":252},[247,783,785,788,790,793,795],{"class":140,"line":784},37,[247,786,787],{"class":260},"    border-radius",[247,789,394],{"class":252},[247,791,792],{"class":260},"12",[247,794,693],{"class":561},[247,796,403],{"class":252},[247,798,800,802,804,806,808,811],{"class":140,"line":799},38,[247,801,649],{"class":260},[247,803,394],{"class":252},[247,805,654],{"class":260},[247,807,657],{"class":252},[247,809,810],{"class":422},"--surface-alt",[247,812,438],{"class":252},[247,814,816],{"class":140,"line":815},39,[247,817,537],{"class":252},[247,819,821,823,826,829,832,834,836,838,841],{"class":140,"line":820},40,[247,822,725],{"class":260},[247,824,825],{"class":256}," p",[247,827,828],{"class":252}," { ",[247,830,831],{"class":260},"color",[247,833,394],{"class":252},[247,835,654],{"class":260},[247,837,657],{"class":252},[247,839,840],{"class":422},"--text-muted",[247,842,843],{"class":252},"); }\n",[247,845,847,849,852,854,856,858,860,862,865],{"class":140,"line":846},41,[247,848,725],{"class":260},[247,850,851],{"class":256}," a",[247,853,828],{"class":252},[247,855,831],{"class":260},[247,857,394],{"class":252},[247,859,654],{"class":260},[247,861,657],{"class":252},[247,863,864],{"class":422},"--accent",[247,866,843],{"class":252},[247,868,870],{"class":140,"line":869},42,[247,871,410],{"emptyLinePlaceholder":409},[247,873,875],{"class":140,"line":874},43,[247,876,877],{"class":384},"  \u002F* A permanently dark region inside any theme, e.g. a code sample. *\u002F\n",[247,879,881,884],{"class":140,"line":880},44,[247,882,883],{"class":260},"  .code-panel",[247,885,378],{"class":252},[247,887,889,891,893,895],{"class":140,"line":888},45,[247,890,391],{"class":260},[247,892,394],{"class":252},[247,894,600],{"class":260},[247,896,403],{"class":252},[247,898,900,902,904,906,908,910],{"class":140,"line":899},46,[247,901,649],{"class":260},[247,903,394],{"class":252},[247,905,654],{"class":260},[247,907,657],{"class":252},[247,909,660],{"class":422},[247,911,438],{"class":252},[247,913,915,917,919,921,923,925],{"class":140,"line":914},47,[247,916,668],{"class":260},[247,918,394],{"class":252},[247,920,654],{"class":260},[247,922,657],{"class":252},[247,924,677],{"class":422},[247,926,438],{"class":252},[247,928,930,932,934,936,938],{"class":140,"line":929},48,[247,931,634],{"class":260},[247,933,394],{"class":252},[247,935,766],{"class":260},[247,937,641],{"class":561},[247,939,403],{"class":252},[247,941,943,945,947,950,952],{"class":140,"line":942},49,[247,944,787],{"class":260},[247,946,394],{"class":252},[247,948,949],{"class":260},"8",[247,951,693],{"class":561},[247,953,403],{"class":252},[247,955,957],{"class":140,"line":956},50,[247,958,537],{"class":252},[247,960,962,965,967],{"class":140,"line":961},51,[247,963,964],{"class":252},"\u003C\u002F",[247,966,367],{"class":256},[247,968,264],{"class":252},[247,970,972,974,976],{"class":140,"line":971},52,[247,973,964],{"class":252},[247,975,300],{"class":256},[247,977,264],{"class":252},[247,979,981,983,986],{"class":140,"line":980},53,[247,982,270],{"class":252},[247,984,985],{"class":256},"body",[247,987,264],{"class":252},[247,989,991,994,997,1000,1002,1005],{"class":140,"line":990},54,[247,992,993],{"class":252},"  \u003C",[247,995,996],{"class":256},"div",[247,998,999],{"class":260}," class",[247,1001,278],{"class":252},[247,1003,1004],{"class":281},"\"card\"",[247,1006,264],{"class":252},[247,1008,1010,1013,1015,1018,1020],{"class":140,"line":1009},55,[247,1011,1012],{"class":252},"    \u003C",[247,1014,61],{"class":256},[247,1016,1017],{"class":252},">Invoice #1042\u003C\u002F",[247,1019,61],{"class":256},[247,1021,264],{"class":252},[247,1023,1025,1027,1029,1032,1034,1037,1039,1042,1045,1047,1050,1052],{"class":140,"line":1024},56,[247,1026,1012],{"class":252},[247,1028,20],{"class":256},[247,1030,1031],{"class":252},">Due in 14 days. \u003C",[247,1033,50],{"class":256},[247,1035,1036],{"class":260}," href",[247,1038,278],{"class":252},[247,1040,1041],{"class":281},"\"\u002Finvoices\u002F1042\u002F\"",[247,1043,1044],{"class":252},">View details\u003C\u002F",[247,1046,50],{"class":256},[247,1048,1049],{"class":252},">\u003C\u002F",[247,1051,20],{"class":256},[247,1053,264],{"class":252},[247,1055,1057,1059,1061,1063,1065,1068,1071,1073],{"class":140,"line":1056},57,[247,1058,1012],{"class":252},[247,1060,238],{"class":256},[247,1062,999],{"class":260},[247,1064,278],{"class":252},[247,1066,1067],{"class":281},"\"code-panel\"",[247,1069,1070],{"class":252},">amount: 240.00\u003C\u002F",[247,1072,238],{"class":256},[247,1074,264],{"class":252},[247,1076,1078,1081,1083],{"class":140,"line":1077},58,[247,1079,1080],{"class":252},"  \u003C\u002F",[247,1082,996],{"class":256},[247,1084,264],{"class":252},[247,1086,1088,1090,1092],{"class":140,"line":1087},59,[247,1089,964],{"class":252},[247,1091,985],{"class":256},[247,1093,264],{"class":252},[247,1095,1097,1099,1101],{"class":140,"line":1096},60,[247,1098,964],{"class":252},[247,1100,242],{"class":256},[247,1102,264],{"class":252},[20,1104,1105,1106,1108,1109,1112],{},"The toggle itself only needs to set ",[15,1107,231],{}," on the root and remember the choice. A tiny inline script in the ",[15,1110,1111],{},"\u003Chead>"," should apply the stored value before first paint, or the page flashes in the system theme before switching:",[238,1114,1116],{"className":240,"code":1115,"language":242,"meta":243,"style":243},"\u003Cscript>\n  \u002F\u002F Runs before the body renders, so there is no flash of the wrong theme.\n  try {\n    const stored = localStorage.getItem('theme');\n    if (stored === 'light' || stored === 'dark') {\n      document.documentElement.dataset.theme = stored;\n    }\n  } catch (e) {}\n\u003C\u002Fscript>\n",[15,1117,1118,1127,1132,1139,1164,1192,1202,1207,1218],{"__ignoreMap":243},[247,1119,1120,1122,1125],{"class":140,"line":249},[247,1121,270],{"class":252},[247,1123,1124],{"class":256},"script",[247,1126,264],{"class":252},[247,1128,1129],{"class":140,"line":267},[247,1130,1131],{"class":384},"  \u002F\u002F Runs before the body renders, so there is no flash of the wrong theme.\n",[247,1133,1134,1137],{"class":140,"line":295},[247,1135,1136],{"class":561},"  try",[247,1138,378],{"class":252},[247,1140,1141,1144,1147,1150,1153,1157,1159,1162],{"class":140,"line":305},[247,1142,1143],{"class":561},"    const",[247,1145,1146],{"class":260}," stored",[247,1148,1149],{"class":561}," =",[247,1151,1152],{"class":252}," localStorage.",[247,1154,1156],{"class":1155},"sKwhi","getItem",[247,1158,657],{"class":252},[247,1160,1161],{"class":281},"'theme'",[247,1163,438],{"class":252},[247,1165,1166,1169,1172,1175,1178,1181,1184,1186,1189],{"class":140,"line":323},[247,1167,1168],{"class":561},"    if",[247,1170,1171],{"class":252}," (stored ",[247,1173,1174],{"class":561},"===",[247,1176,1177],{"class":281}," 'light'",[247,1179,1180],{"class":561}," ||",[247,1182,1183],{"class":252}," stored ",[247,1185,1174],{"class":561},[247,1187,1188],{"class":281}," 'dark'",[247,1190,1191],{"class":252},") {\n",[247,1193,1194,1197,1199],{"class":140,"line":348},[247,1195,1196],{"class":252},"      document.documentElement.dataset.theme ",[247,1198,278],{"class":561},[247,1200,1201],{"class":252}," stored;\n",[247,1203,1204],{"class":140,"line":362},[247,1205,1206],{"class":252},"    }\n",[247,1208,1209,1212,1215],{"class":140,"line":372},[247,1210,1211],{"class":252},"  } ",[247,1213,1214],{"class":561},"catch",[247,1216,1217],{"class":252}," (e) {}\n",[247,1219,1220,1222,1224],{"class":140,"line":381},[247,1221,964],{"class":252},[247,1223,1124],{"class":256},[247,1225,264],{"class":252},[61,1227,1229],{"id":1228},"the-key-technique-the-token-is-computed-where-it-is-declared","The key technique: the token is computed where it is declared",[20,1231,1232,1233,1236,1237,1239,1240,1242,1243,1245,1246,1248,1249,1252,1253,1255,1256,1259],{},"The trap that catches almost everyone is custom-property evaluation. A custom property holding ",[15,1234,1235],{},"light-dark(#fff, #0f172a)"," is not resolved to a colour on ",[15,1238,25],{}," and then inherited as that colour. Registered or not, the ",[15,1241,17],{}," value is resolved where it is ",[198,1244,200],{}," as a colour — but only if the property's value is still the unresolved function by then. For unregistered custom properties, the token is inherited as its specified text and resolved at the use site, against that element's ",[15,1247,44],{},". That is exactly what makes the ",[15,1250,1251],{},".code-panel"," work: it sets ",[15,1254,211],{},", and ",[15,1257,1258],{},"var(--surface)"," inside it resolves to the dark value even when the page is light.",[84,1261,91,1264,91,1267,91,1270,91,1273,91,1276,91,1281,91,1287,91,1294,91,1299,91,1303,91,1308],{"viewBox":1262,"role":87,"ariaLabel":1263,"xmlns":89,"style":90},"0 0 720 280","A light page containing a dark code panel: the same token resolves to the light value on the page and to the dark value inside the panel",[93,1265,1266],{},"One token, two resolutions",[97,1268,1269],{},"The page has color-scheme light, so var(--surface) resolves to white there. A nested panel sets color-scheme dark, so the same var(--surface) inside it resolves to the dark value.",[101,1271,1272],{"textAnchor":103,"x":104,"y":105,"style":106},"The same var(--surface) in two schemes",[109,1274],{"x":170,"y":151,"width":1275,"height":113,"rx":792,"fill":116,"stroke":117,"strokeWidth":118,"opacity":119},"640",[101,1277,1280],{"textAnchor":184,"x":186,"y":1278,"style":1279},"78","text-anchor:start;fill:currentColor;font:600 13px ui-monospace,monospace",":root { color-scheme: light }",[101,1282,1286],{"textAnchor":1283,"x":1284,"y":1278,"style":1285},"end","660","text-anchor:end;fill:currentColor;font:12px sans-serif","--surface → #ffffff",[109,1288],{"x":1289,"y":1290,"width":1291,"height":1292,"rx":115,"fill":117,"opacity":1293},"100","104","520","116","0.2",[101,1295,1298],{"textAnchor":184,"x":1296,"y":1297,"style":1279},"120","134",".code-panel { color-scheme: dark }",[101,1300,1302],{"textAnchor":1283,"x":1301,"y":1297,"style":1285},"600","--surface → #0f172a",[101,1304,1307],{"textAnchor":103,"x":104,"y":1305,"style":1306},"182","text-anchor:middle;fill:currentColor;font:12px sans-serif","The token is resolved at the element that uses it,",[101,1309,1311],{"textAnchor":103,"x":104,"y":1310,"style":1306},"202","so nested regions can flip scheme without new tokens.",[20,1313,1314,1315,1318,1319,1321,1322,1325,1326,1328,1329,1331,1332,1336],{},"The corollary is a warning about ",[15,1316,1317],{},"@property",". If you register ",[15,1320,660],{}," with ",[15,1323,1324],{},"syntax: \"\u003Ccolor>\"",", its computed value is resolved to a concrete colour on the element where it is declared — ",[15,1327,25],{}," — and descendants inherit that concrete colour. Nested scheme changes then stop working. Keep theme tokens that use ",[15,1330,17],{}," unregistered, and register only properties you need to animate, as discussed in ",[50,1333,1335],{"href":1334},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture\u002Fregistered-properties-and-type-safety\u002F","Registered Properties and Type Safety",".",[61,1338,1340],{"id":1339},"migrating-an-existing-two-block-theme","Migrating an existing two-block theme",[20,1342,1343,1344,1346],{},"Most sites adopting ",[15,1345,17],{}," already have a working theme built from two blocks of custom properties. The migration can be done token by token without a big-bang rewrite.",[20,1348,1349,1350,1352,1353,1356,1357,1359,1360,1362,1363,1365],{},"Start by adding ",[15,1351,44],{}," to the root: ",[15,1354,1355],{},"light dark"," if the site follows the system, and the explicit value under each ",[15,1358,231],{}," attribute if it has a toggle. This alone improves the page, because form controls and scrollbars now match the theme. Then take one token at a time: write its light and dark values into a single ",[15,1361,17],{}," declaration on ",[15,1364,25],{},", and delete the token from the dark block. The site looks identical at every step, because both mechanisms agree, which makes each step easy to verify with a screenshot diff in both themes.",[20,1367,1368,1369,1371,1372,1375,1376,1379,1380,1382],{},"Two kinds of token do not migrate. Values that are not colours — shadow offsets, image URLs, filter amounts — stay in the dark block or a media query, since ",[15,1370,17],{}," accepts only colours. And tokens that depend on ",[198,1373,1374],{},"other"," tokens with maths, such as a ",[15,1377,1378],{},"color-mix()"," of two themed colours, should be checked carefully: they work as long as both inputs are unregistered ",[15,1381,17],{}," tokens resolved at the same element, but a registered input will freeze to the root's scheme. When the dark block finally contains only non-colour values, the migration is complete.",[61,1384,1386],{"id":1385},"contrast-in-both-themes","Contrast in both themes",[20,1388,1389,1390,1392],{},"Pairing colours makes it easy to review contrast, but it does not do the review for you. Dark themes have their own traps: pure white text on pure black causes halation for some readers, and saturated brand colours that pass on white often fail on dark backgrounds, which is why the example's ",[15,1391,864],{}," lightens from indigo-700 to indigo-300 in dark mode. Check every token pair against the surfaces it sits on, in both themes, for WCAG 1.4.3 text contrast and 1.4.11 non-text contrast.",[20,1394,1395,1396,1399,1400,1402],{},"For users who need more, ",[15,1397,1398],{},"prefers-contrast: more"," can be layered on top: a media query that swaps the muted tokens for stronger ones in both schemes, still using ",[15,1401,17],{}," so the pairing is preserved.",[61,1404,1406],{"id":1405},"variation-animating-the-theme-switch","Variation: animating the theme switch",[20,1408,1409,1410,1412,1413,432,1416,1418,1419,1422],{},"Because ",[15,1411,17],{}," resolves to ordinary colours, a theme switch changes computed ",[15,1414,1415],{},"background-color",[15,1417,831],{}," and ",[15,1420,1421],{},"border-color"," values, and those can be transitioned. A short transition on the main surfaces turns the switch into a gentle crossfade rather than a flash.",[238,1424,1428],{"className":1425,"code":1426,"language":1427,"meta":243,"style":243},"language-css shiki shiki-themes github-light-high-contrast github-dark-high-contrast","body,\n.card {\n  transition:\n    background-color 200ms ease,\n    color 200ms ease,\n    border-color 200ms ease;\n}\n\n@media (prefers-reduced-motion: reduce) {\n  body, .card { transition: none; }\n}\n","css",[15,1429,1430,1437,1444,1452,1467,1480,1493,1498,1502,1510,1529],{"__ignoreMap":243},[247,1431,1432,1434],{"class":140,"line":249},[247,1433,985],{"class":256},[247,1435,1436],{"class":252},",\n",[247,1438,1439,1442],{"class":140,"line":267},[247,1440,1441],{"class":260},".card",[247,1443,378],{"class":252},[247,1445,1446,1449],{"class":140,"line":295},[247,1447,1448],{"class":260},"  transition",[247,1450,1451],{"class":252},":\n",[247,1453,1454,1457,1459,1462,1465],{"class":140,"line":305},[247,1455,1456],{"class":252},"    background-color ",[247,1458,113],{"class":260},[247,1460,1461],{"class":561},"ms",[247,1463,1464],{"class":260}," ease",[247,1466,1436],{"class":252},[247,1468,1469,1471,1474,1476,1478],{"class":140,"line":323},[247,1470,668],{"class":260},[247,1472,1473],{"class":260}," 200",[247,1475,1461],{"class":561},[247,1477,1464],{"class":260},[247,1479,1436],{"class":252},[247,1481,1482,1485,1487,1489,1491],{"class":140,"line":348},[247,1483,1484],{"class":252},"    border-color ",[247,1486,113],{"class":260},[247,1488,1461],{"class":561},[247,1490,1464],{"class":260},[247,1492,403],{"class":252},[247,1494,1495],{"class":140,"line":362},[247,1496,1497],{"class":252},"}\n",[247,1499,1500],{"class":140,"line":372},[247,1501,410],{"emptyLinePlaceholder":409},[247,1503,1504,1507],{"class":140,"line":381},[247,1505,1506],{"class":561},"@media",[247,1508,1509],{"class":252}," (prefers-reduced-motion: reduce) {\n",[247,1511,1512,1514,1516,1518,1520,1523,1525,1527],{"class":140,"line":388},[247,1513,613],{"class":256},[247,1515,432],{"class":252},[247,1517,1441],{"class":260},[247,1519,828],{"class":252},[247,1521,1522],{"class":260},"transition",[247,1524,394],{"class":252},[247,1526,116],{"class":260},[247,1528,576],{"class":252},[247,1530,1531],{"class":140,"line":406},[247,1532,1497],{"class":252},[20,1534,1535,1536,1336],{},"Transitioning every element is expensive and produces staggered-looking results, so apply it to the few large surfaces that dominate the view. The whole-page approach, including a view-transition-based wipe, is covered in ",[50,1537,1539],{"href":1538},"\u002Fcss-only-micro-interactions-animations\u002Fcolor-and-theme-transitions\u002Fsmooth-theme-switching-transitions\u002F","Smooth Theme Switching Transitions",[61,1541,1543],{"id":1542},"browser-support","Browser support",[20,1545,1546,1548,1549,1551,1552,1554,1555,1557,1558,1560,1561,1564],{},[15,1547,17],{}," is supported in current versions of Chrome, Edge, Firefox and Safari. ",[15,1550,44],{}," is supported in all of them and has been for longer. For older engines, declare the light colour as a plain value before each ",[15,1553,17],{}," token, or keep a ",[15,1556,29],{}," block as a fallback; unsupported ",[15,1559,17],{}," declarations are ignored, leaving the earlier value in place. ",[15,1562,1563],{},"prefers-contrast"," is supported in Chrome and Edge 96+, Firefox 101+ and Safari 14.1+.",[61,1566,1568],{"id":1567},"faq","FAQ",[20,1570,1571,1578,1579,1581,1582,1584,1585,1587,1588,1590],{},[1572,1573,1574,1575,1577],"strong",{},"How does ",[15,1576,17],{}," decide which colour to use?","\nIt returns its first argument when the element's used ",[15,1580,44],{}," is light and its second when it is dark. The used ",[15,1583,44],{}," comes from the ",[15,1586,44],{}," property, which inherits, combined with the user's operating-system preference when ",[15,1589,44],{}," allows both.",[20,1592,1593,1599,1600,1602,1603,1605,1606,1608,1609,1611,1612,1614,1615,1617,1618,1620,1621,1623],{},[1572,1594,1595,1596,1598],{},"Why does ",[15,1597,17],{}," always return the light colour?","\nBecause ",[15,1601,44],{}," is not set, or is set to ",[15,1604,397],{}," only. ",[15,1607,17],{}," does nothing unless the element's ",[15,1610,44],{}," includes ",[15,1613,600],{},". Set ",[15,1616,207],{}," on the root to follow the system, or set it explicitly to ",[15,1619,397],{}," or ",[15,1622,600],{}," from a theme toggle.",[20,1625,1626,1632],{},[1572,1627,1628,1629,1631],{},"Can ",[15,1630,17],{}," be used for images or lengths?","\nThe original function only accepts colours. It is designed for colour tokens: backgrounds, text, borders and shadows. Use a data attribute or a media query for anything else that changes between themes, such as images or shadow sizes.",[20,1634,1635,1641,1642,1644,1645,1647],{},[1572,1636,1637,1638,1640],{},"Does ",[15,1639,17],{}," replace a custom-property theme system?","\nIt complements one. Define each colour token once with ",[15,1643,17],{},", and components keep referencing the token. The theme switch then becomes a single ",[15,1646,44],{}," change on the root rather than a second block of overrides for every token.",[61,1649,1651],{"id":1650},"related","Related",[1653,1654,1655,1661,1666,1673],"ul",{},[1656,1657,1658,1660],"li",{},[50,1659,53],{"href":52}," — the parent guide.",[1656,1662,1663,1665],{},[50,1664,1539],{"href":1538}," — animating the moment of the switch.",[1656,1667,1668,1672],{},[50,1669,1671],{"href":1670},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state\u002Fcontainer-style-query-theming\u002F","Container Style Query Theming"," — section-level themes with style queries.",[1656,1674,1675,1679],{},[50,1676,1678],{"href":1677},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies\u002Fcascade-layers-for-reset-and-tokens\u002F","Cascade Layers for Reset and Tokens"," — where theme tokens live in the cascade.",[367,1681,1682],{},"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 .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 pre.shiki code .sHUrx, html code.shiki .sHUrx{--shiki-default:#A0111F;--shiki-dark:#FF9492}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);}html pre.shiki code .sKwhi, html code.shiki .sKwhi{--shiki-default:#622CBC;--shiki-dark:#DBB7FF}",{"title":243,"searchDepth":267,"depth":267,"links":1684},[1685,1686,1687,1688,1689,1690,1691,1692,1693,1694],{"id":63,"depth":267,"text":64},{"id":81,"depth":267,"text":82},{"id":221,"depth":267,"text":222},{"id":1228,"depth":267,"text":1229},{"id":1339,"depth":267,"text":1340},{"id":1385,"depth":267,"text":1386},{"id":1405,"depth":267,"text":1406},{"id":1542,"depth":267,"text":1543},{"id":1567,"depth":267,"text":1568},{"id":1650,"depth":267,"text":1651},"Declare both theme colours in one place with light-dark() and color-scheme, drive it from a toggle via data attributes, and avoid the inheritance traps.","md",{"pageTitle":1698,"datePublished":1699,"dateModified":1699,"faq":1700},"Light and Dark Themes With light-dark()","2026-09-18",[1701,1704,1707,1710],{"q":1702,"a":1703},"How does light-dark() decide which colour to use?","It returns its first argument when the element's used color-scheme is light and its second when it is dark. The used color-scheme comes from the color-scheme property, which inherits, combined with the user's operating-system preference when color-scheme allows both.",{"q":1705,"a":1706},"Why does light-dark() always return the light colour?","Because color-scheme is not set, or is set to light only. light-dark() does nothing unless the element's color-scheme includes dark. Set color-scheme: light dark on the root to follow the system, or set it explicitly to light or dark from a theme toggle.",{"q":1708,"a":1709},"Can light-dark() be used for images or lengths?","The original function only accepts colours. It is designed for colour tokens: backgrounds, text, borders and shadows. Use a data attribute or a media query for anything else that changes between themes, such as images or shadow sizes.",{"q":1711,"a":1712},"Does light-dark() replace a custom-property theme system?","It complements one. Define each colour token once with light-dark(), and components keep referencing the token. The theme switch then becomes a single color-scheme change on the root rather than a second block of overrides for every token.","\u002Fcss-only-micro-interactions-animations\u002Fcolor-and-theme-transitions\u002Flight-dark-function-for-themes",{"title":5,"description":1695},"css-only-micro-interactions-animations\u002Fcolor-and-theme-transitions\u002Flight-dark-function-for-themes\u002Findex","ZwjUqcbJFSFQ6zlt9PGgUWqHarVRUxQa8uUMtNox3uE",[1718,1721,1724,1727,1730,1733,1736,1739,1742,1745,1748,1751,1754,1757,1760,1763,1766,1769,1772,1773,1776,1779,1782,1785,1788,1791,1794,1797,1800,1803,1806,1809,1812,1815,1818,1821,1824,1827,1830,1833,1836,1839,1842,1845,1848,1851,1854,1857,1860,1863,1866,1869,1872,1875,1878,1881,1884,1887,1890,1893,1896,1899,1902,1905,1908,1911,1914,1917,1920,1923,1926,1929,1932,1935,1938,1941,1944,1947,1950,1953,1956,1959,1962,1965,1968,1971,1974,1977,1980,1983,1986,1989,1992,1995,1997,2000,2003,2006,2009,2012,2015,2018,2021,2024,2027,2030,2033,2036,2039,2042,2045,2048,2051,2054,2057,2060,2063,2066,2069,2072,2075,2078,2081,2084,2087,2090,2093,2096,2099,2102,2105,2108,2111,2114,2117,2120,2123,2126,2129,2132,2135,2138,2141,2144,2147,2150,2153,2156,2159,2162,2165,2168,2171,2174,2177,2180,2183,2186,2189,2192,2195,2198,2201,2204,2207,2210,2213,2216,2219,2222,2225,2228,2231,2234,2237,2240,2243,2246,2249,2252,2255,2258,2261,2264,2267,2270,2273],{"path":1719,"title":1720},"\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":1722,"title":1723},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fflashing-content-and-seizure-thresholds","Flashing Content and Seizure Thresholds",{"path":1725,"title":1726},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fforced-colors-mode-and-animations","Forced Colors Mode and Animations",{"path":1728,"title":1729},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations","Accessibility in CSS Animations: Patterns, Specs & Best Practices",{"path":1731,"title":1732},"\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":1734,"title":1735},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fprefers-reduced-motion-recipes","prefers-reduced-motion Recipes: A Reduction for Every Common Effect",{"path":1737,"title":1738},"\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":1740,"title":1741},"\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":1743,"title":1744},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fvestibular-safe-animation-patterns","Vestibular-Safe Animation Patterns: Why Some Motion Makes People Sick",{"path":1746,"title":1747},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fwcag-motion-success-criteria","WCAG Motion Success Criteria: What Each One Actually Requires",{"path":1749,"title":1750},"\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":1752,"title":1753},"\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":1755,"title":1756},"\u002Fcss-only-micro-interactions-animations\u002Fclip-path-and-mask-animations","Clip-Path & Mask Animations: Animating Visibility Instead of Position",{"path":1758,"title":1759},"\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":1761,"title":1762},"\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":1764,"title":1765},"\u002Fcss-only-micro-interactions-animations\u002Fcolor-and-theme-transitions\u002Fanimating-gradients","Animating CSS Gradients: Smooth Colour Motion Without Jumps",{"path":1767,"title":1768},"\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":1770,"title":1771},"\u002Fcss-only-micro-interactions-animations\u002Fcolor-and-theme-transitions","Color & Theme Transitions: Colour as Part of the Motion System",{"path":1713,"title":5},{"path":1774,"title":1775},"\u002Fcss-only-micro-interactions-animations\u002Fcolor-and-theme-transitions\u002Fsmooth-theme-switching-transitions","Smooth Theme Switching: Crossfades, Circular Reveals and No Flash",{"path":1777,"title":1778},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion\u002Fcontainer-query-hover-affordances","Container Query Hover Affordances: When Narrow Means Persistent, Not Hidden",{"path":1780,"title":1781},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion","Container-Aware Motion: Animation Sized by the Space a Component Actually Has",{"path":1783,"title":1784},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion\u002Flayout-change-animations-at-container-breakpoints","Animating Changes at Container Breakpoints",{"path":1786,"title":1787},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion\u002Fmotion-driven-by-container-style-queries","Motion Driven by Container Style Queries",{"path":1789,"title":1790},"\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":1792,"title":1793},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion\u002Fsuppressing-motion-in-small-containers","Suppressing Motion in Small Containers: Deliberately Animating Nothing",{"path":1795,"title":1796},"\u002Fcss-only-micro-interactions-animations\u002Fcss-animation-vs-web-animations-api\u002Fcontrolling-css-animations-from-javascript","Controlling CSS Animations From JavaScript",{"path":1798,"title":1799},"\u002Fcss-only-micro-interactions-animations\u002Fcss-animation-vs-web-animations-api","CSS Animation vs the Web Animations API: A Decision Guide",{"path":1801,"title":1802},"\u002Fcss-only-micro-interactions-animations\u002Fcss-animation-vs-web-animations-api\u002Fwaapi-vs-css-for-interruptible-ui","Interruptible UI: CSS Transitions vs WAAPI",{"path":1804,"title":1805},"\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":1807,"title":1808},"\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":1810,"title":1811},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture\u002Fcustom-property-fallbacks-and-invalid-values","Custom Property Fallbacks and Invalid Values",{"path":1813,"title":1814},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture\u002Ffluid-spacing-tokens-driving-transition-durations","Fluid Spacing Tokens That Drive Transition Durations",{"path":1816,"title":1817},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture","CSS Custom Properties Architecture: Scalable Design Systems & Dynamic UI",{"path":1819,"title":1820},"\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":1822,"title":1823},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture\u002Fscoping-custom-properties-to-components","Scoping Custom Properties to Components",{"path":1825,"title":1826},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Fcss-transition-timing-functions","CSS Transition Timing Functions: ease, cubic-bezier(), steps() and linear()",{"path":1828,"title":1829},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals","CSS Transition Fundamentals: Architecture, Performance & Patterns",{"path":1831,"title":1832},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Finterrupted-and-reversing-transitions","Interrupted and Reversing Transitions: What Happens Mid-Flight",{"path":1834,"title":1835},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Fstarting-style-entry-animations","@starting-style: Animating an Element's Very First Style Change",{"path":1837,"title":1838},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Ftransition-delay-choreography","Choreographing Motion With transition-delay",{"path":1840,"title":1841},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Ftransition-shorthand-and-multiple-properties","The transition Shorthand and Multiple Properties",{"path":1843,"title":1844},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Ftransitioning-display-with-allow-discrete","Transitioning display with transition-behavior: allow-discrete and @starting-style",{"path":1846,"title":1847},"\u002Fcss-only-micro-interactions-animations\u002Fdialog-and-popover-animations\u002Fanimating-dialog-open-and-close","Animating \u003Cdialog> Open and Close: Both Directions, No Library",{"path":1849,"title":1850},"\u002Fcss-only-micro-interactions-animations\u002Fdialog-and-popover-animations\u002Fbackdrop-animations","Animating ::backdrop: Fades and Blurs Behind Dialogs and Popovers",{"path":1852,"title":1853},"\u002Fcss-only-micro-interactions-animations\u002Fdialog-and-popover-animations","Dialog & Popover Animations: Motion for the Top Layer",{"path":1855,"title":1856},"\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":1858,"title":1859},"\u002Fcss-only-micro-interactions-animations\u002Fdialog-and-popover-animations\u002Fpopover-entry-and-exit-transitions","Popover Menus That Animate From Their Anchor",{"path":1861,"title":1862},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design\u002Fchoosing-animation-durations","Choosing Animation Durations: How Long Motion Should Last",{"path":1864,"title":1865},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design\u002Fcubic-bezier-overshoot-and-anticipation","Overshoot and Anticipation With cubic-bezier(): Motion With Character",{"path":1867,"title":1868},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design\u002Fentry-vs-exit-easing","Entry vs Exit Easing: Different Curves for Arriving and Leaving",{"path":1870,"title":1871},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design","Easing & Motion Design: Making CSS Motion Feel Intentional",{"path":1873,"title":1874},"\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":1876,"title":1877},"\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":1879,"title":1880},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design\u002Faccessible-css-only-tooltips","Accessible CSS-Only Tooltips and Hover Cards With  and ",{"path":1882,"title":1883},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design\u002Fbutton-press-and-active-states","Button Press and  States",{"path":1885,"title":1886},"\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":1888,"title":1889},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design\u002Ffocus-within-form-patterns"," Form Patterns: Styling a Group From the Field Inside It",{"path":1891,"title":1892},"\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":1894,"title":1895},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design","Hover & Focus State Design: Spec-Compliant Patterns for Modern UIs",{"path":1897,"title":1898},"\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":1900,"title":1901},"\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":1903,"title":1904},"\u002Fcss-only-micro-interactions-animations","CSS-Only Micro-Interactions & Animations: Architecture, Performance & Implementation",{"path":1906,"title":1907},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fanimation-composition-and-stacking","Stacking Animations With animation-composition",{"path":1909,"title":1910},"\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":1912,"title":1913},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fcontainer-query-triggered-keyframe-animations","Container-Query-Triggered Keyframe Animations: Animate Differently per Available Space",{"path":1915,"title":1916},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fcss-only-accordions-and-disclosure","CSS-Only Accordions and Disclosure Widgets with details and summary",{"path":1918,"title":1919},"\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":1921,"title":1922},"\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":1924,"title":1925},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns","Keyframe Animation Patterns: Spec-Compliant Architectures for Modern UIs",{"path":1927,"title":1928},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fmulti-step-keyframes-and-per-keyframe-easing","Multi-Step Keyframes and Per-Keyframe Easing",{"path":1930,"title":1931},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fstaggered-list-animations-with-custom-properties","Staggered List Animations Using --i Index Custom Properties",{"path":1933,"title":1934},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Fanimating-box-shadow-and-filters-cheaply","Animating box-shadow and Filters Cheaply",{"path":1936,"title":1937},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Fcontain-property-for-animation-performance","The contain Property for Animation Performance",{"path":1939,"title":1940},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Fcss-triggers-layout-paint-composite","Layout, Paint and Composite: What Triggers What",{"path":1942,"title":1943},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration","Performance & GPU Acceleration in CSS: A Developer’s Blueprint",{"path":1945,"title":1946},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Foptimizing-css-animations-for-60fps","Optimizing CSS Animations for 60fps: Budgeting the Frame",{"path":1948,"title":1949},"\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":1951,"title":1952},"\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":1954,"title":1955},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations","Scroll-Driven Animations: Binding Motion to Scroll Position in Pure CSS",{"path":1957,"title":1958},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fscroll-driven-animation-fallbacks","Shipping Scroll-Driven Animations Without Breaking Anything",{"path":1960,"title":1961},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fscroll-driven-parallax-effects","Scroll-Driven Parallax Effects in CSS",{"path":1963,"title":1964},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fscroll-progress-bar-without-javascript","A Reading Progress Bar Driven by scroll(root)",{"path":1966,"title":1967},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fscroll-triggered-reveal-animations","Reveal-on-Scroll with view() and animation-range",{"path":1969,"title":1970},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Ftimeline-scope-for-cross-element-animations","timeline-scope for Cross-Element Animations",{"path":1972,"title":1973},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fview-timeline-and-animation-range","View Timelines and animation-range",{"path":1975,"title":1976},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fcross-document-view-transitions","Cross-Document View Transitions",{"path":1978,"title":1979},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers","View Transitions for CSS Developers: the Pseudo-Element Tree, Snapshots, and Named Elements",{"path":1981,"title":1982},"\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":1984,"title":1985},"\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":1987,"title":1988},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fview-transition-types-and-classes","View Transition Types and Classes",{"path":1990,"title":1991},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fview-transitions-for-list-reordering","View Transitions for List Reordering",{"path":1993,"title":1994},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fview-transitions-with-reduced-motion","Honouring prefers-reduced-motion in View Transitions",{"path":696,"title":1996},"Modern CSS Layouts & Micro-Interactions",{"path":1998,"title":1999},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fanchor-positioned-tooltips","Anchor-Positioned Tooltips: Tethering, Flipping, and Getting the Semantics Right",{"path":2001,"title":2002},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fanchor-positioning-fallbacks","Anchor Positioning Fallbacks: A Graceful Floor for Older Browser Versions",{"path":2004,"title":2005},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fanchor-size-for-matching-widths","anchor-size(): Overlays That Match Their Trigger's Size",{"path":2007,"title":2008},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays","CSS Anchor Positioning and Overlays: Tethering Elements Without JavaScript",{"path":2010,"title":2011},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fpopover-attribute-and-css-styling","The popover Attribute: Top-Layer Overlays With No JavaScript",{"path":2013,"title":2014},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fpopover-light-dismiss-and-stacking","Popover Light Dismiss, Nesting and Stacking",{"path":2016,"title":2017},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fposition-area-grid-explained","position-area: The Anchor Placement Grid",{"path":2019,"title":2020},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Fcontainer-query-polyfill-tradeoffs","Container Query Polyfills: What They Cost and When to Skip Them",{"path":2022,"title":2023},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Ffeature-detection-with-supports","Feature Detection with @supports: Syntax, Semantics, and the Traps",{"path":2025,"title":2026},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Fhandling-container-query-fallbacks-for-older-browsers","Handling Container Query Fallbacks for Older Browsers",{"path":2028,"title":2029},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks","Container Query Fallbacks: Spec-Compliant CSS Strategies for Legacy Browsers",{"path":2031,"title":2032},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Fintrinsic-layout-fallbacks-without-queries","Intrinsic Layout Fallbacks: Baselines That Adapt Without Any Query",{"path":2034,"title":2035},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Ftesting-fallbacks-without-old-browsers","Testing CSS Fallbacks Without an Old Browser",{"path":2037,"title":2038},"\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":2040,"title":2041},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fcontainer-query-range-and-logic-operators","Container Query Range Syntax and Logic Operators",{"path":2043,"title":2044},"\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":2046,"title":2047},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fcontainer-type-size-vs-inline-size","Choosing container-type: inline-size, size, or normal",{"path":2049,"title":2050},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fcontainer-vs-media-queries-comparison","Container vs Media Queries: Choosing the Right Reference Box",{"path":2052,"title":2053},"\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":2055,"title":2056},"\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":2058,"title":2059},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics","Container Query Syntax Basics",{"path":2061,"title":2062},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fnesting-and-naming-container-queries","Nesting and Naming Container Queries: Targeting the Right Ancestor",{"path":2064,"title":2065},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fauto-fit-minmax-responsive-grids","Responsive Grids with repeat(auto-fit, minmax())",{"path":2067,"title":2068},"\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":2070,"title":2071},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fgrid-auto-flow-dense-packing","grid-auto-flow: dense for Packed Layouts",{"path":2073,"title":2074},"\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":2076,"title":2077},"\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":2079,"title":2080},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts","CSS Grid and Subgrid Layouts for Responsive Interfaces",{"path":2082,"title":2083},"\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":2085,"title":2086},"\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":2088,"title":2089},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fsubgrid-vs-nested-grid","Subgrid vs an Independently Nested Grid",{"path":2091,"title":2092},"\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":2094,"title":2095},"\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":2097,"title":2098},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fflex-grow-and-flex-shrink-explained","flex-grow and flex-shrink Explained",{"path":2100,"title":2101},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fflex-wrap-intrinsic-responsive-rows","Breakpoint-Free Responsive Rows With flex-wrap and flex-basis",{"path":2103,"title":2104},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fflexbox-gap-and-spacing","Flexbox gap vs Margins: Spacing Items Without Edge Hacks",{"path":2106,"title":2107},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns","Flexbox Layout Patterns: One-Dimensional Layout for Real Components",{"path":2109,"title":2110},"\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":2112,"title":2113},"\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":2115,"title":2116},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp\u002Fdebugging-clamp-values","Debugging clamp(): Values That Are Ignored, Stuck or Never Fluid",{"path":2118,"title":2119},"\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":2121,"title":2122},"\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":2124,"title":2125},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp\u002Ffluid-type-accessibility-and-zoom","Fluid Type, Accessibility and Zoom: The vw-Only Trap",{"path":2127,"title":2128},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp\u002Ffluid-typography-without-javascript","Fluid Typography Without JavaScript: A Precision CSS Reference",{"path":2130,"title":2131},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp","Fluid Typography with clamp(): A Practical Guide for Modern CSS",{"path":2133,"title":2134},"\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":2136,"title":2137},"\u002Fmastering-container-queries-responsive-layouts","Mastering Container Queries & Responsive Layouts",{"path":2139,"title":2140},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Faspect-ratio-for-responsive-media","Using aspect-ratio for Responsive Media and Preventing Layout Shift",{"path":2142,"title":2143},"\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":2145,"title":2146},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques","Intrinsic Sizing Techniques: Modern CSS Layouts for Responsive UI",{"path":2148,"title":2149},"\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":2151,"title":2152},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Fmin-max-fit-content-explained","min-content, max-content, and fit-content() Explained",{"path":2154,"title":2155},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Fobject-fit-and-object-position","object-fit and object-position: Images That Fit Any Box",{"path":2157,"title":2158},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Fpreventing-flex-and-grid-overflow","The min-width: auto Trap in Flex and Grid Layouts",{"path":2160,"title":2161},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies\u002Fcascade-layers-for-reset-and-tokens","Cascade Layers for Reset and Design Tokens",{"path":2163,"title":2164},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies\u002Fcascade-layers-vs-specificity-hacks","Cascade Layers vs Specificity Hacks: Ordering Instead of Escalating",{"path":2166,"title":2167},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies\u002Fcss-scope-for-component-styles","@scope for Component Styles: Short Selectors That Cannot Leak",{"path":2169,"title":2170},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies","Modern CSS Reset Strategies: A Spec-Compliant Foundation",{"path":2172,"title":2173},"\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":2175,"title":2176},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies\u002Fwriting-a-minimal-modern-reset","Writing a Minimal Modern CSS Reset: Every Line Justified",{"path":2178,"title":2179},"\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":2181,"title":2182},"\u002Fmastering-container-queries-responsive-layouts\u002Fparent-aware-layouts-with-has\u002Fempty-and-loading-states-with-has","Empty and Loading States With ()",{"path":2184,"title":2185},"\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":2187,"title":2188},"\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":2190,"title":2191},"\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":2193,"title":2194},"\u002Fmastering-container-queries-responsive-layouts\u002Fparent-aware-layouts-with-has","Parent-Aware Layouts With :has(): Letting Containers React to Their Contents",{"path":2196,"title":2197},"\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":2199,"title":2200},"\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":2202,"title":2203},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fcontainer-query-data-tables","Container Query Data Tables: Reflowing Tables to Cards",{"path":2205,"title":2206},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fcontainer-query-sidebar-layouts","Container Query Sidebar Layouts That Travel Between Contexts",{"path":2208,"title":2209},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns","Responsive Component Patterns: Architecture & Implementation",{"path":2211,"title":2212},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fresponsive-forms-with-container-queries","Responsive Forms with Container Queries: Reflow Without Losing the Wiring",{"path":2214,"title":2215},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fresponsive-hero-sections-with-container-queries","Responsive Hero Sections With Container Queries",{"path":2217,"title":2218},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fresponsive-navigation-without-media-queries","Responsive Navigation Without Media Queries Using Container Queries",{"path":2220,"title":2221},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fresponsive-pricing-tables","Responsive Pricing Tables: Aligned Features, a Clear Recommendation, Any Width",{"path":2223,"title":2224},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Ftabs-that-become-accordions","Tabs That Become an Accordion: One Component, Two Layouts",{"path":2226,"title":2227},"\u002Fmastering-container-queries-responsive-layouts\u002Fscroll-snap-and-overflow-layouts\u002Fcss-only-carousel-with-scroll-snap","A CSS-Only Carousel With Scroll Snap",{"path":2229,"title":2230},"\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":2232,"title":2233},"\u002Fmastering-container-queries-responsive-layouts\u002Fscroll-snap-and-overflow-layouts","Scroll Snap & Overflow Layouts: Designing Components That Scroll on Purpose",{"path":2235,"title":2236},"\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":2238,"title":2239},"\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":2241,"title":2242},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state\u002Fcombining-size-and-style-queries","Combining Size and Style Container Queries",{"path":2244,"title":2245},"\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":2247,"title":2248},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state","Style Queries and Container State: Token-Driven Component Variants",{"path":2250,"title":2251},"\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":2253,"title":2254},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state\u002Fstyle-query-component-variants","Component Variants With Style Queries: One Token, Many Looks",{"path":2256,"title":2257},"\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":2259,"title":2260},"\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":2262,"title":2263},"\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":2265,"title":2266},"\u002Fmastering-container-queries-responsive-layouts\u002Fviewport-units-and-mobile-layout","Viewport Units & Mobile Layout: Designing for the Screen You Actually Get",{"path":2268,"title":2269},"\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":2271,"title":2272},"\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":2274,"title":2275},"\u002Fmastering-container-queries-responsive-layouts\u002Fviewport-units-and-mobile-layout\u002Fvirtual-keyboard-and-interactive-widget","Layouts That Survive the Virtual Keyboard",{"title":2277,"caption":2278,"height":2279,"resizable":409,"html":2280,"css":2281},"The same light-dark() tokens under two color-scheme values","Both cards use identical CSS; only color-scheme differs, and every light-dark() token resolves to its matching half.",300,"\n\u003Cdiv class=\"pair\">\n  \u003Cdiv class=\"scheme\" style=\"color-scheme: light\">\n    \u003Cdiv class=\"card\">\u003Ch2>Invoice #1042\u003C\u002Fh2>\u003Cp>Due in 14 days. \u003Ca href=\"#\">View details\u003C\u002Fa>\u003C\u002Fp>\u003Cpre class=\"code-panel\">amount: 240.00\u003C\u002Fpre>\u003C\u002Fdiv>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"scheme\" style=\"color-scheme: dark\">\n    \u003Cdiv class=\"card\">\u003Ch2>Invoice #1042\u003C\u002Fh2>\u003Cp>Due in 14 days. \u003Ca href=\"#\">View details\u003C\u002Fa>\u003C\u002Fp>\u003Cpre class=\"code-panel\">amount: 240.00\u003C\u002Fpre>\u003C\u002Fdiv>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>","\n:root {\n  --surface: light-dark(#ffffff, #0f172a);\n  --surface-alt: light-dark(#f1f5f9, #1e293b);\n  --text: light-dark(#0f172a, #e2e8f0);\n  --text-muted: light-dark(#475569, #94a3b8);\n  --border: light-dark(#cbd5e1, #334155);\n  --accent: light-dark(#4338ca, #a5b4fc);\n}\nbody { display: block; }\n.pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; }\n.scheme { padding: 1rem; border-radius: 12px; background: var(--surface); color: var(--text); }\n.card { padding: 1rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-alt); }\n.card h2 { margin: 0 0 0.4rem; font-size: 1.05rem; }\n.card p { margin: 0 0 0.6rem; color: var(--text-muted); }\n.card a { color: var(--accent); }\n.code-panel { color-scheme: dark; margin: 0; background: var(--surface); color: var(--text); padding: 0.6rem; border-radius: 8px; }",1789717749285]