[{"data":1,"prerenderedAt":2396},["ShallowReactive",2],{"page-\u002Fmastering-container-queries-responsive-layouts\u002Fparent-aware-layouts-with-has\u002Fhas-vs-container-style-queries\u002F":3,"content-all-pages":1838},{"id":4,"title":5,"body":6,"description":1818,"extension":1819,"meta":1820,"navigation":400,"path":1834,"seo":1835,"stem":1836,"__hash__":1837},"content\u002Fmastering-container-queries-responsive-layouts\u002Fparent-aware-layouts-with-has\u002Fhas-vs-container-style-queries\u002Findex.md",":has() vs Container Style Queries: Discovered State and Published State",{"type":7,"value":8,"toc":1807},"minimark",[9,18,47,52,66,176,186,190,197,1069,1083,1087,1195,1202,1208,1334,1338,1416,1441,1461,1465,1468,1499,1529,1544,1548,1561,1689,1702,1706,1723,1727,1737,1749,1755,1764,1768,1804],[10,11,13,17],"h1",{"id":12},"has-vs-container-style-queries-discovered-state-and-published-state",[14,15,16],"code",{},":has()"," vs Container Style Queries: Discovered State and Published State",[19,20,21,22,28,29,33,34,28,38,41,42,46],"p",{},"Both features let a component react to something other than its own classes, and both shipped within a couple of years of each other, so teams often reach for whichever one they learned first. They are not interchangeable. ",[23,24,26],"a",{"href":25},"\u002Fmastering-container-queries-responsive-layouts\u002Fparent-aware-layouts-with-has\u002F",[14,27,16],{}," ",[30,31,32],"em",{},"discovers"," state by inspecting the DOM beneath an element. A ",[23,35,37],{"href":36},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state\u002F","container style query",[30,39,40],{},"reads published state"," — a custom property's computed value on an ancestor. This page compares them on the axes that decide which one to use: where the state lives, how far it travels, how it composes, and what it costs. It sits in the ",[23,43,45],{"href":44},"\u002Fmastering-container-queries-responsive-layouts\u002F","Mastering Container Queries & Responsive Layouts"," guide.",[48,49,51],"h2",{"id":50},"two-directions-of-information-flow","Two directions of information flow",[19,53,54,55,57,58,61,62,65],{},"The simplest way to tell them apart is to follow the information. With ",[14,56,16],{},", information flows ",[30,59,60],{},"upward",": a descendant's existence or state reaches an ancestor, which styles itself. With a style query, information flows ",[30,63,64],{},"downward",": an ancestor's custom property reaches its descendants through inheritance, and they style themselves.",[67,68,74,75,74,79,74,83,74,91,74,97,74,107,74,112,74,119,74,123,74,126,74,130,74,137,74,141,74,146,74,150,74,153,74,156,74,158,74,161,74,163,74,166,74,170,74,173],"svg",{"viewBox":69,"role":70,"ariaLabel":71,"xmlns":72,"style":73},"0 0 720 330","img","Two trees: has sends information up from a descendant to an ancestor; a style query sends a custom property down from a container to descendants","http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg","width:100%;height:auto;max-width:720px;margin:2rem 0","\n  ",[76,77,78],"title",{},"Upward discovery versus downward publication",[80,81,82],"desc",{},"Left, an arrow runs up from a checked input to the card that matches has. Right, an arrow runs down from a container setting a tone custom property to the heading and button that match a style query.",[84,85,90],"text",{"textAnchor":86,"x":87,"y":88,"style":89},"middle","360","26","text-anchor:middle;fill:currentColor;font:700 17px sans-serif","Which way the state travels",[84,92,96],{"textAnchor":86,"x":93,"y":94,"style":95},"190","56","text-anchor:middle;fill:currentColor;font:600 13px ui-monospace,monospace",":has() discovers",[98,99],"rect",{"x":100,"y":101,"width":102,"height":103,"rx":104,"fill":105,"opacity":106},"90","72","200","44","8","#7aa2ff","0.34",[84,108,111],{"textAnchor":86,"x":93,"y":109,"style":110},"99","text-anchor:middle;fill:currentColor;font:12px ui-monospace,monospace",".card  ← styled",[98,113],{"x":100,"y":114,"width":102,"height":103,"rx":104,"fill":115,"stroke":116,"strokeWidth":117,"opacity":118},"150","none","currentColor","1.5","0.55",[84,120,122],{"textAnchor":86,"x":93,"y":121,"style":110},"177",".card__body",[98,124],{"x":100,"y":125,"width":102,"height":103,"rx":104,"fill":115,"stroke":116,"strokeWidth":117,"opacity":118},"228",[84,127,129],{"textAnchor":86,"x":93,"y":128,"style":110},"255","input:checked",[131,132],"line",{"x1":133,"y1":134,"x2":133,"y2":135,"stroke":105,"strokeWidth":136},"60","250","94","4",[138,139],"path",{"d":140,"fill":105},"M50 108 L60 90 L70 108 Z",[84,142,145],{"textAnchor":86,"x":93,"y":143,"style":144},"304","text-anchor:middle;fill:currentColor;font:12px sans-serif","state lives in the DOM",[84,147,149],{"textAnchor":86,"x":148,"y":94,"style":95},"530","style() reads",[98,151],{"x":152,"y":101,"width":102,"height":103,"rx":104,"fill":115,"stroke":116,"strokeWidth":117,"opacity":118},"430",[84,154,155],{"textAnchor":86,"x":148,"y":109,"style":110},"--tone: alert",[98,157],{"x":152,"y":114,"width":102,"height":103,"rx":104,"fill":105,"opacity":106},[84,159,160],{"textAnchor":86,"x":148,"y":121,"style":110},"h2  ← styled",[98,162],{"x":152,"y":125,"width":102,"height":103,"rx":104,"fill":105,"opacity":106},[84,164,165],{"textAnchor":86,"x":148,"y":128,"style":110},"button  ← styled",[131,167],{"x1":168,"y1":135,"x2":168,"y2":169,"stroke":105,"strokeWidth":136},"660","246",[138,171],{"d":172,"fill":105},"M650 234 L660 252 L670 234 Z",[84,174,175],{"textAnchor":86,"x":148,"y":143,"style":144},"state lives in a property",[19,177,178,179,181,182,185],{},"Most of the practical differences follow from that. ",[14,180,16],{}," can react to things that are not styles at all — the presence of an element, a form control's checked or invalid state, focus, hover. A style query can only react to a custom property value, but that value can come from anywhere above: a class on a distant section wrapper, an inline style set by a CMS, a ",[14,183,184],{},"@layer"," of theme tokens, or even another rule that converted DOM state into a property.",[48,187,189],{"id":188},"the-complete-implementation-one-alert-panel-both-ways","The complete implementation: one alert panel, both ways",[19,191,192,193,196],{},"The panel below shows an alert tone in two ways. Version A discovers the tone by checking which radio button inside it is selected. Version B reads a ",[14,194,195],{},"--tone"," property published by whatever section it sits inside.",[198,199,204],"pre",{"className":200,"code":201,"language":202,"meta":203,"style":203},"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>:has() vs style queries\u003C\u002Ftitle>\n\u003Cstyle>\n  body { font: 15px\u002F1.5 system-ui, sans-serif; margin: 1.5rem; display: grid; gap: 1.5rem; }\n\n  .panel {\n    padding: 1rem;\n    border: 2px solid #94a3b8;\n    border-radius: 10px;\n  }\n  .panel h2 { margin: 0 0 0.5rem; font-size: 1.1rem; }\n\n  \u002F* ---- Version A: discovered with :has() ----------------------------- *\u002F\n  \u002F* The state is a form control inside the panel. The panel inspects\n     its own subtree and restyles itself. *\u002F\n  .panel--a:has(input[value=\"alert\"]:checked) {\n    border-color: #b91c1c;\n    background: #fef2f2;\n  }\n  .panel--a:has(input[value=\"calm\"]:checked) {\n    border-color: #15803d;\n    background: #f0fdf4;\n  }\n\n  \u002F* ---- Version B: published with a property, read by style() ---------- *\u002F\n  \u002F* Any ancestor can publish --tone. Here it is a section wrapper that\n     could be many levels above the panel. *\u002F\n  .section--alert { --tone: alert; }\n  .section--calm  { --tone: calm; }\n\n  \u002F* The section is the query container. Style queries need a container\n     but not a size container-type, so container-name alone is enough. *\u002F\n  .section { container-name: section; }\n\n  @container section style(--tone: alert) {\n    .panel--b { border-color: #b91c1c; background: #fef2f2; }\n  }\n  @container section style(--tone: calm) {\n    .panel--b { border-color: #15803d; background: #f0fdf4; }\n  }\n\u003C\u002Fstyle>\n\u003C\u002Fhead>\n\u003Cbody>\n  \u003Cdiv class=\"panel panel--a\">\n    \u003Ch2>A: tone picked inside\u003C\u002Fh2>\n    \u003Clabel>\u003Cinput type=\"radio\" name=\"tone\" value=\"calm\" checked> Calm\u003C\u002Flabel>\n    \u003Clabel>\u003Cinput type=\"radio\" name=\"tone\" value=\"alert\"> Alert\u003C\u002Flabel>\n  \u003C\u002Fdiv>\n\n  \u003Csection class=\"section section--alert\">\n    \u003Cdiv class=\"panel panel--b\">\n      \u003Ch2>B: tone set by the section\u003C\u002Fh2>\n      \u003Cp>This panel does not know why it is red; it only reads --tone.\u003C\u002Fp>\n    \u003C\u002Fdiv>\n  \u003C\u002Fsection>\n\u003C\u002Fbody>\n\u003C\u002Fhtml>\n","html","",[14,205,206,225,245,255,273,298,312,322,395,402,411,427,448,463,469,508,513,520,526,532,564,577,590,595,619,631,643,648,653,659,665,671,685,699,704,710,716,730,735,744,770,775,783,806,811,821,830,840,859,874,919,955,965,970,987,1003,1018,1032,1042,1051,1060],{"__ignoreMap":203},[207,208,210,214,218,222],"span",{"class":131,"line":209},1,[207,211,213],{"class":212},"suds8","\u003C!",[207,215,217],{"class":216},"sne4z","doctype",[207,219,221],{"class":220},"s-5SL"," html",[207,223,224],{"class":212},">\n",[207,226,228,231,233,236,239,243],{"class":131,"line":227},2,[207,229,230],{"class":212},"\u003C",[207,232,202],{"class":216},[207,234,235],{"class":220}," lang",[207,237,238],{"class":212},"=",[207,240,242],{"class":241},"sT6z2","\"en\"",[207,244,224],{"class":212},[207,246,248,250,253],{"class":131,"line":247},3,[207,249,230],{"class":212},[207,251,252],{"class":216},"head",[207,254,224],{"class":212},[207,256,258,260,263,266,268,271],{"class":131,"line":257},4,[207,259,230],{"class":212},[207,261,262],{"class":216},"meta",[207,264,265],{"class":220}," charset",[207,267,238],{"class":212},[207,269,270],{"class":241},"\"utf-8\"",[207,272,224],{"class":212},[207,274,276,278,280,283,285,288,291,293,296],{"class":131,"line":275},5,[207,277,230],{"class":212},[207,279,262],{"class":216},[207,281,282],{"class":220}," name",[207,284,238],{"class":212},[207,286,287],{"class":241},"\"viewport\"",[207,289,290],{"class":220}," content",[207,292,238],{"class":212},[207,294,295],{"class":241},"\"width=device-width, initial-scale=1\"",[207,297,224],{"class":212},[207,299,301,303,305,308,310],{"class":131,"line":300},6,[207,302,230],{"class":212},[207,304,76],{"class":216},[207,306,307],{"class":212},">:has() vs style queries\u003C\u002F",[207,309,76],{"class":216},[207,311,224],{"class":212},[207,313,315,317,320],{"class":131,"line":314},7,[207,316,230],{"class":212},[207,318,319],{"class":216},"style",[207,321,224],{"class":212},[207,323,325,328,331,334,337,340,344,347,349,352,355,358,361,364,366,368,371,373,376,378,381,383,386,388,390,392],{"class":131,"line":324},8,[207,326,327],{"class":216},"  body",[207,329,330],{"class":212}," { ",[207,332,333],{"class":220},"font",[207,335,336],{"class":212},": ",[207,338,339],{"class":220},"15",[207,341,343],{"class":342},"sHUrx","px",[207,345,346],{"class":212},"\u002F",[207,348,117],{"class":220},[207,350,351],{"class":220}," system-ui",[207,353,354],{"class":212},", ",[207,356,357],{"class":220},"sans-serif",[207,359,360],{"class":212},"; ",[207,362,363],{"class":220},"margin",[207,365,336],{"class":212},[207,367,117],{"class":220},[207,369,370],{"class":342},"rem",[207,372,360],{"class":212},[207,374,375],{"class":220},"display",[207,377,336],{"class":212},[207,379,380],{"class":220},"grid",[207,382,360],{"class":212},[207,384,385],{"class":220},"gap",[207,387,336],{"class":212},[207,389,117],{"class":220},[207,391,370],{"class":342},[207,393,394],{"class":212},"; }\n",[207,396,398],{"class":131,"line":397},9,[207,399,401],{"emptyLinePlaceholder":400},true,"\n",[207,403,405,408],{"class":131,"line":404},10,[207,406,407],{"class":220},"  .panel",[207,409,410],{"class":212}," {\n",[207,412,414,417,419,422,424],{"class":131,"line":413},11,[207,415,416],{"class":220},"    padding",[207,418,336],{"class":212},[207,420,421],{"class":220},"1",[207,423,370],{"class":342},[207,425,426],{"class":212},";\n",[207,428,430,433,435,438,440,443,446],{"class":131,"line":429},12,[207,431,432],{"class":220},"    border",[207,434,336],{"class":212},[207,436,437],{"class":220},"2",[207,439,343],{"class":342},[207,441,442],{"class":220}," solid",[207,444,445],{"class":220}," #94a3b8",[207,447,426],{"class":212},[207,449,451,454,456,459,461],{"class":131,"line":450},13,[207,452,453],{"class":220},"    border-radius",[207,455,336],{"class":212},[207,457,458],{"class":220},"10",[207,460,343],{"class":342},[207,462,426],{"class":212},[207,464,466],{"class":131,"line":465},14,[207,467,468],{"class":212},"  }\n",[207,470,472,474,477,479,481,483,486,489,492,494,496,499,501,504,506],{"class":131,"line":471},15,[207,473,407],{"class":220},[207,475,476],{"class":216}," h2",[207,478,330],{"class":212},[207,480,363],{"class":220},[207,482,336],{"class":212},[207,484,485],{"class":220},"0",[207,487,488],{"class":220}," 0",[207,490,491],{"class":220}," 0.5",[207,493,370],{"class":342},[207,495,360],{"class":212},[207,497,498],{"class":220},"font-size",[207,500,336],{"class":212},[207,502,503],{"class":220},"1.1",[207,505,370],{"class":342},[207,507,394],{"class":212},[207,509,511],{"class":131,"line":510},16,[207,512,401],{"emptyLinePlaceholder":400},[207,514,516],{"class":131,"line":515},17,[207,517,519],{"class":518},"sLBg1","  \u002F* ---- Version A: discovered with :has() ----------------------------- *\u002F\n",[207,521,523],{"class":131,"line":522},18,[207,524,525],{"class":518},"  \u002F* The state is a form control inside the panel. The panel inspects\n",[207,527,529],{"class":131,"line":528},19,[207,530,531],{"class":518},"     its own subtree and restyles itself. *\u002F\n",[207,533,535,538,541,544,547,550,552,555,558,561],{"class":131,"line":534},20,[207,536,537],{"class":220},"  .panel--a:has",[207,539,540],{"class":212},"(",[207,542,543],{"class":216},"input",[207,545,546],{"class":212},"[",[207,548,549],{"class":220},"value",[207,551,238],{"class":342},[207,553,554],{"class":241},"\"alert\"",[207,556,557],{"class":212},"]",[207,559,560],{"class":220},":checked",[207,562,563],{"class":212},") {\n",[207,565,567,570,572,575],{"class":131,"line":566},21,[207,568,569],{"class":220},"    border-color",[207,571,336],{"class":212},[207,573,574],{"class":220},"#b91c1c",[207,576,426],{"class":212},[207,578,580,583,585,588],{"class":131,"line":579},22,[207,581,582],{"class":220},"    background",[207,584,336],{"class":212},[207,586,587],{"class":220},"#fef2f2",[207,589,426],{"class":212},[207,591,593],{"class":131,"line":592},23,[207,594,468],{"class":212},[207,596,598,600,602,604,606,608,610,613,615,617],{"class":131,"line":597},24,[207,599,537],{"class":220},[207,601,540],{"class":212},[207,603,543],{"class":216},[207,605,546],{"class":212},[207,607,549],{"class":220},[207,609,238],{"class":342},[207,611,612],{"class":241},"\"calm\"",[207,614,557],{"class":212},[207,616,560],{"class":220},[207,618,563],{"class":212},[207,620,622,624,626,629],{"class":131,"line":621},25,[207,623,569],{"class":220},[207,625,336],{"class":212},[207,627,628],{"class":220},"#15803d",[207,630,426],{"class":212},[207,632,634,636,638,641],{"class":131,"line":633},26,[207,635,582],{"class":220},[207,637,336],{"class":212},[207,639,640],{"class":220},"#f0fdf4",[207,642,426],{"class":212},[207,644,646],{"class":131,"line":645},27,[207,647,468],{"class":212},[207,649,651],{"class":131,"line":650},28,[207,652,401],{"emptyLinePlaceholder":400},[207,654,656],{"class":131,"line":655},29,[207,657,658],{"class":518},"  \u002F* ---- Version B: published with a property, read by style() ---------- *\u002F\n",[207,660,662],{"class":131,"line":661},30,[207,663,664],{"class":518},"  \u002F* Any ancestor can publish --tone. Here it is a section wrapper that\n",[207,666,668],{"class":131,"line":667},31,[207,669,670],{"class":518},"     could be many levels above the panel. *\u002F\n",[207,672,674,677,679,682],{"class":131,"line":673},32,[207,675,676],{"class":220},"  .section--alert",[207,678,330],{"class":212},[207,680,195],{"class":681},"soyes",[207,683,684],{"class":212},": alert; }\n",[207,686,688,691,694,696],{"class":131,"line":687},33,[207,689,690],{"class":220},"  .section--calm",[207,692,693],{"class":212},"  { ",[207,695,195],{"class":681},[207,697,698],{"class":212},": calm; }\n",[207,700,702],{"class":131,"line":701},34,[207,703,401],{"emptyLinePlaceholder":400},[207,705,707],{"class":131,"line":706},35,[207,708,709],{"class":518},"  \u002F* The section is the query container. Style queries need a container\n",[207,711,713],{"class":131,"line":712},36,[207,714,715],{"class":518},"     but not a size container-type, so container-name alone is enough. *\u002F\n",[207,717,719,722,724,727],{"class":131,"line":718},37,[207,720,721],{"class":220},"  .section",[207,723,330],{"class":212},[207,725,726],{"class":220},"container-name",[207,728,729],{"class":212},": section; }\n",[207,731,733],{"class":131,"line":732},38,[207,734,401],{"emptyLinePlaceholder":400},[207,736,738,741],{"class":131,"line":737},39,[207,739,740],{"class":342},"  @container",[207,742,743],{"class":212}," section style(--tone: alert) {\n",[207,745,747,750,752,755,757,759,761,764,766,768],{"class":131,"line":746},40,[207,748,749],{"class":220},"    .panel--b",[207,751,330],{"class":212},[207,753,754],{"class":220},"border-color",[207,756,336],{"class":212},[207,758,574],{"class":220},[207,760,360],{"class":212},[207,762,763],{"class":220},"background",[207,765,336],{"class":212},[207,767,587],{"class":220},[207,769,394],{"class":212},[207,771,773],{"class":131,"line":772},41,[207,774,468],{"class":212},[207,776,778,780],{"class":131,"line":777},42,[207,779,740],{"class":342},[207,781,782],{"class":212}," section style(--tone: calm) {\n",[207,784,786,788,790,792,794,796,798,800,802,804],{"class":131,"line":785},43,[207,787,749],{"class":220},[207,789,330],{"class":212},[207,791,754],{"class":220},[207,793,336],{"class":212},[207,795,628],{"class":220},[207,797,360],{"class":212},[207,799,763],{"class":220},[207,801,336],{"class":212},[207,803,640],{"class":220},[207,805,394],{"class":212},[207,807,809],{"class":131,"line":808},44,[207,810,468],{"class":212},[207,812,814,817,819],{"class":131,"line":813},45,[207,815,816],{"class":212},"\u003C\u002F",[207,818,319],{"class":216},[207,820,224],{"class":212},[207,822,824,826,828],{"class":131,"line":823},46,[207,825,816],{"class":212},[207,827,252],{"class":216},[207,829,224],{"class":212},[207,831,833,835,838],{"class":131,"line":832},47,[207,834,230],{"class":212},[207,836,837],{"class":216},"body",[207,839,224],{"class":212},[207,841,843,846,849,852,854,857],{"class":131,"line":842},48,[207,844,845],{"class":212},"  \u003C",[207,847,848],{"class":216},"div",[207,850,851],{"class":220}," class",[207,853,238],{"class":212},[207,855,856],{"class":241},"\"panel panel--a\"",[207,858,224],{"class":212},[207,860,862,865,867,870,872],{"class":131,"line":861},49,[207,863,864],{"class":212},"    \u003C",[207,866,48],{"class":216},[207,868,869],{"class":212},">A: tone picked inside\u003C\u002F",[207,871,48],{"class":216},[207,873,224],{"class":212},[207,875,877,879,882,885,887,890,892,895,897,899,902,905,907,909,912,915,917],{"class":131,"line":876},50,[207,878,864],{"class":212},[207,880,881],{"class":216},"label",[207,883,884],{"class":212},">\u003C",[207,886,543],{"class":216},[207,888,889],{"class":220}," type",[207,891,238],{"class":212},[207,893,894],{"class":241},"\"radio\"",[207,896,282],{"class":220},[207,898,238],{"class":212},[207,900,901],{"class":241},"\"tone\"",[207,903,904],{"class":220}," value",[207,906,238],{"class":212},[207,908,612],{"class":241},[207,910,911],{"class":220}," checked",[207,913,914],{"class":212},"> Calm\u003C\u002F",[207,916,881],{"class":216},[207,918,224],{"class":212},[207,920,922,924,926,928,930,932,934,936,938,940,942,944,946,948,951,953],{"class":131,"line":921},51,[207,923,864],{"class":212},[207,925,881],{"class":216},[207,927,884],{"class":212},[207,929,543],{"class":216},[207,931,889],{"class":220},[207,933,238],{"class":212},[207,935,894],{"class":241},[207,937,282],{"class":220},[207,939,238],{"class":212},[207,941,901],{"class":241},[207,943,904],{"class":220},[207,945,238],{"class":212},[207,947,554],{"class":241},[207,949,950],{"class":212},"> Alert\u003C\u002F",[207,952,881],{"class":216},[207,954,224],{"class":212},[207,956,958,961,963],{"class":131,"line":957},52,[207,959,960],{"class":212},"  \u003C\u002F",[207,962,848],{"class":216},[207,964,224],{"class":212},[207,966,968],{"class":131,"line":967},53,[207,969,401],{"emptyLinePlaceholder":400},[207,971,973,975,978,980,982,985],{"class":131,"line":972},54,[207,974,845],{"class":212},[207,976,977],{"class":216},"section",[207,979,851],{"class":220},[207,981,238],{"class":212},[207,983,984],{"class":241},"\"section section--alert\"",[207,986,224],{"class":212},[207,988,990,992,994,996,998,1001],{"class":131,"line":989},55,[207,991,864],{"class":212},[207,993,848],{"class":216},[207,995,851],{"class":220},[207,997,238],{"class":212},[207,999,1000],{"class":241},"\"panel panel--b\"",[207,1002,224],{"class":212},[207,1004,1006,1009,1011,1014,1016],{"class":131,"line":1005},56,[207,1007,1008],{"class":212},"      \u003C",[207,1010,48],{"class":216},[207,1012,1013],{"class":212},">B: tone set by the section\u003C\u002F",[207,1015,48],{"class":216},[207,1017,224],{"class":212},[207,1019,1021,1023,1025,1028,1030],{"class":131,"line":1020},57,[207,1022,1008],{"class":212},[207,1024,19],{"class":216},[207,1026,1027],{"class":212},">This panel does not know why it is red; it only reads --tone.\u003C\u002F",[207,1029,19],{"class":216},[207,1031,224],{"class":212},[207,1033,1035,1038,1040],{"class":131,"line":1034},58,[207,1036,1037],{"class":212},"    \u003C\u002F",[207,1039,848],{"class":216},[207,1041,224],{"class":212},[207,1043,1045,1047,1049],{"class":131,"line":1044},59,[207,1046,960],{"class":212},[207,1048,977],{"class":216},[207,1050,224],{"class":212},[207,1052,1054,1056,1058],{"class":131,"line":1053},60,[207,1055,816],{"class":212},[207,1057,837],{"class":216},[207,1059,224],{"class":212},[207,1061,1063,1065,1067],{"class":131,"line":1062},61,[207,1064,816],{"class":212},[207,1066,202],{"class":216},[207,1068,224],{"class":212},[19,1070,1071,1072,1074,1075,1078,1079,1082],{},"Version A is self-contained: the panel owns the control, so discovery is natural. Version B is decoupled: the panel has no idea which class or element set ",[14,1073,195],{},", and the same panel dropped into a ",[14,1076,1077],{},".section--calm",", or into a CMS block with ",[14,1080,1081],{},"style=\"--tone: calm\"",", adapts with no change to its CSS.",[48,1084,1086],{"id":1085},"the-key-technique-choosing-by-where-the-state-lives","The key technique: choosing by where the state lives",[67,1088,74,1091,74,1094,74,1097,74,1100,74,1105,74,1110,74,1115,74,1119,74,1126,74,1132,74,1138,74,1141,74,1145,74,1149,74,1152,74,1156,74,1160,74,1164,74,1168,74,1172,74,1176,74,1181,74,1185,74,1188,74,1192],{"viewBox":1089,"role":70,"ariaLabel":1090,"xmlns":72,"style":73},"0 0 720 310","Decision flow choosing between has and a style query based on whether the state is DOM state or a value, and whether it comes from inside or above",[76,1092,1093],{},"Picking the mechanism",[80,1095,1096],{},"If the state is DOM state such as presence, checked or hover, use has. If it is a value, ask where it comes from: from inside the component, a class is enough; from above, use a style query.",[84,1098,1099],{"textAnchor":86,"x":87,"y":88,"style":89},"Ask where the state lives first",[98,1101],{"x":1102,"y":103,"width":1103,"height":103,"rx":104,"fill":115,"stroke":116,"strokeWidth":117,"opacity":1104},"220","280","0.6",[84,1106,1109],{"textAnchor":86,"x":87,"y":1107,"style":1108},"71","text-anchor:middle;fill:currentColor;font:13px sans-serif","Is it DOM state or a value?",[131,1111],{"x1":1103,"y1":1112,"x2":1113,"y2":1114,"stroke":116,"strokeWidth":117,"opacity":1104},"88","170","130",[131,1116],{"x1":1117,"y1":1112,"x2":1118,"y2":1114,"stroke":116,"strokeWidth":117,"opacity":1104},"440","540",[84,1120,1125],{"textAnchor":1121,"x":1122,"y":1123,"style":1124},"end","214","108","text-anchor:end;fill:currentColor;font:12px sans-serif","DOM state",[84,1127,1131],{"textAnchor":1128,"x":1129,"y":1123,"style":1130},"start","498","text-anchor:start;fill:currentColor;font:12px sans-serif","a value",[98,1133],{"x":1134,"y":1114,"width":1135,"height":1136,"rx":104,"fill":105,"opacity":1137},"40","260","80","0.32",[84,1139,16],{"textAnchor":86,"x":1113,"y":1140,"style":95},"156",[84,1142,1144],{"textAnchor":86,"x":1113,"y":1143,"style":144},"178","presence, checked,",[84,1146,1148],{"textAnchor":86,"x":1113,"y":1147,"style":144},"196","invalid, focus, hover",[98,1150],{"x":1151,"y":1114,"width":1103,"height":103,"rx":104,"fill":115,"stroke":116,"strokeWidth":117,"opacity":1104},"400",[84,1153,1155],{"textAnchor":86,"x":1118,"y":1154,"style":1108},"157","Set inside or above?",[131,1157],{"x1":1158,"y1":1159,"x2":1117,"y2":1102,"stroke":116,"strokeWidth":117,"opacity":1104},"480","174",[131,1161],{"x1":1162,"y1":1159,"x2":1163,"y2":1102,"stroke":116,"strokeWidth":117,"opacity":1104},"600","620",[84,1165,1167],{"textAnchor":1121,"x":1166,"y":102,"style":1124},"454","inside",[84,1169,1171],{"textAnchor":1128,"x":1170,"y":102,"style":1130},"616","above",[98,1173],{"x":1174,"y":1102,"width":93,"height":133,"rx":104,"fill":105,"opacity":1175},"340","0.18",[84,1177,1180],{"textAnchor":86,"x":1178,"y":169,"style":1179},"435","text-anchor:middle;fill:currentColor;font:600 13px sans-serif","a class or attribute",[84,1182,1184],{"textAnchor":86,"x":1178,"y":1183,"style":144},"266","no query needed",[98,1186],{"x":1187,"y":1102,"width":114,"height":133,"rx":104,"fill":105,"opacity":1137},"550",[84,1189,1191],{"textAnchor":86,"x":1190,"y":169,"style":95},"625","style()",[84,1193,1194],{"textAnchor":86,"x":1190,"y":1183,"style":144},"inherited value",[19,1196,1197,1198,1201],{},"The middle branch is worth dwelling on, because it is where teams over-engineer. If a component sets a value on itself and styles itself from it, neither feature is needed — a class or attribute selector is simpler and faster. Style queries exist for values that arrive ",[30,1199,1200],{},"from outside"," the component through inheritance, where the component cannot know which selector set them.",[19,1203,1204,1205,1207],{},"The two can also be chained, and this is a powerful pattern. A component uses ",[14,1206,16],{}," to discover DOM state and publishes it as a property; descendants anywhere below read the property with a style query. The component's internal structure can change freely, because descendants depend only on the published name.",[198,1209,1213],{"className":1210,"code":1211,"language":1212,"meta":203,"style":203},"language-css shiki shiki-themes github-light-high-contrast github-dark-high-contrast","\u002F* Discover once, near the source... *\u002F\n.product:has(> .product__options input[value=\"gift\"]:checked) {\n  --product-mode: gift;\n}\n\n\u002F* ...and let any descendant read the published name. *\u002F\n.product { container-name: product; }\n\n@container product style(--product-mode: gift) {\n  .product__price { text-decoration: line-through; }\n  .product__gift-note { display: block; }\n}\n","css",[14,1214,1215,1220,1251,1259,1264,1268,1273,1285,1289,1297,1314,1330],{"__ignoreMap":203},[207,1216,1217],{"class":131,"line":209},[207,1218,1219],{"class":518},"\u002F* Discover once, near the source... *\u002F\n",[207,1221,1222,1225,1227,1230,1233,1236,1238,1240,1242,1245,1247,1249],{"class":131,"line":227},[207,1223,1224],{"class":220},".product:has",[207,1226,540],{"class":212},[207,1228,1229],{"class":342},">",[207,1231,1232],{"class":220}," .product__options",[207,1234,1235],{"class":216}," input",[207,1237,546],{"class":212},[207,1239,549],{"class":220},[207,1241,238],{"class":342},[207,1243,1244],{"class":241},"\"gift\"",[207,1246,557],{"class":212},[207,1248,560],{"class":220},[207,1250,563],{"class":212},[207,1252,1253,1256],{"class":131,"line":247},[207,1254,1255],{"class":681},"  --product-mode",[207,1257,1258],{"class":212},": gift;\n",[207,1260,1261],{"class":131,"line":257},[207,1262,1263],{"class":212},"}\n",[207,1265,1266],{"class":131,"line":275},[207,1267,401],{"emptyLinePlaceholder":400},[207,1269,1270],{"class":131,"line":300},[207,1271,1272],{"class":518},"\u002F* ...and let any descendant read the published name. *\u002F\n",[207,1274,1275,1278,1280,1282],{"class":131,"line":314},[207,1276,1277],{"class":220},".product",[207,1279,330],{"class":212},[207,1281,726],{"class":220},[207,1283,1284],{"class":212},": product; }\n",[207,1286,1287],{"class":131,"line":324},[207,1288,401],{"emptyLinePlaceholder":400},[207,1290,1291,1294],{"class":131,"line":397},[207,1292,1293],{"class":342},"@container",[207,1295,1296],{"class":212}," product style(--product-mode: gift) {\n",[207,1298,1299,1302,1304,1307,1309,1312],{"class":131,"line":404},[207,1300,1301],{"class":220},"  .product__price",[207,1303,330],{"class":212},[207,1305,1306],{"class":220},"text-decoration",[207,1308,336],{"class":212},[207,1310,1311],{"class":220},"line-through",[207,1313,394],{"class":212},[207,1315,1316,1319,1321,1323,1325,1328],{"class":131,"line":413},[207,1317,1318],{"class":220},"  .product__gift-note",[207,1320,330],{"class":212},[207,1322,375],{"class":220},[207,1324,336],{"class":212},[207,1326,1327],{"class":220},"block",[207,1329,394],{"class":212},[207,1331,1332],{"class":131,"line":429},[207,1333,1263],{"class":212},[48,1335,1337],{"id":1336},"how-they-compare-in-practice","How they compare in practice",[67,1339,74,1342,74,1345,74,1348,74,1351,74,1356,74,1359,74,1362,74,1365,74,1371,74,1374,74,1377,74,1381,74,1384,74,1387,74,1391,74,1394,74,1397,74,1401,74,1404,74,1407,74,1410,74,1413],{"viewBox":1340,"role":70,"ariaLabel":1341,"xmlns":72,"style":73},"0 0 720 300","Comparison grid of has and style queries across five properties",[76,1343,1344],{},"Side-by-side comparison",[80,1346,1347],{},"Rows for what can be tested, direction, reach, element querying itself, and support. Has tests DOM state upward within a subtree; style queries test custom property values downward from any ancestor container.",[84,1349,1350],{"textAnchor":86,"x":87,"y":88,"style":89},"The same job, different constraints",[98,1352],{"x":1353,"y":103,"width":1102,"height":1354,"rx":1355,"fill":105,"opacity":106},"230","32","6",[84,1357,16],{"textAnchor":86,"x":1174,"y":1358,"style":95},"65",[98,1360],{"x":1361,"y":103,"width":1102,"height":1354,"rx":1355,"fill":105,"opacity":106},"470",[84,1363,1191],{"textAnchor":86,"x":1364,"y":1358,"style":95},"580",[84,1366,1370],{"textAnchor":1128,"x":1367,"y":1368,"style":1369},"30","106","text-anchor:start;fill:currentColor;font:600 12px sans-serif","Tests",[84,1372,1373],{"textAnchor":86,"x":1174,"y":1368,"style":144},"any selector",[84,1375,1376],{"textAnchor":86,"x":1364,"y":1368,"style":144},"custom property values",[84,1378,1380],{"textAnchor":1128,"x":1367,"y":1379,"style":1369},"146","Direction",[84,1382,1383],{"textAnchor":86,"x":1174,"y":1379,"style":144},"descendants → element",[84,1385,1386],{"textAnchor":86,"x":1364,"y":1379,"style":144},"container → descendants",[84,1388,1390],{"textAnchor":1128,"x":1367,"y":1389,"style":1369},"186","Reach",[84,1392,1393],{"textAnchor":86,"x":1174,"y":1389,"style":144},"own subtree (and siblings)",[84,1395,1396],{"textAnchor":86,"x":1364,"y":1389,"style":144},"anything inherited",[84,1398,1400],{"textAnchor":1128,"x":1367,"y":1399,"style":1369},"226","Query self?",[84,1402,1403],{"textAnchor":86,"x":1174,"y":1399,"style":144},"yes, it is the subject",[84,1405,1406],{"textAnchor":86,"x":1364,"y":1399,"style":144},"no, needs an ancestor",[84,1408,1409],{"textAnchor":1128,"x":1367,"y":1183,"style":1369},"Firefox",[84,1411,1412],{"textAnchor":86,"x":1174,"y":1183,"style":144},"121+",[84,1414,1415],{"textAnchor":86,"x":1364,"y":1183,"style":144},"151+",[19,1417,1418,1419,1421,1422,1425,1426,1429,1430,1432,1433,1436,1437,1440],{},"Two rows of that grid cause most bugs when switching between them. First, the \"query self\" row: a style query always consults a container ancestor, so writing ",[14,1420,155],{}," on ",[14,1423,1424],{},".panel"," and then ",[14,1427,1428],{},"@container style(--tone: alert) { .panel { … } }"," does nothing — the panel is not its own container. Move the property up one level. Second, the reach row: ",[14,1431,16],{}," can see siblings through ",[14,1434,1435],{},":has(+ x)"," and ",[14,1438,1439],{},":has(~ x)",", which style queries cannot do at all.",[19,1442,1443,1444,1446,1447,1454,1455,1457,1458,1460],{},"Cost is the row deliberately left out, because it depends on the page. ",[14,1445,16],{}," is paid when something in its argument changes, scaled by how broad the anchor is — the analysis in ",[23,1448,1450,1453],{"href":1449},"\u002Fmastering-container-queries-responsive-layouts\u002Fparent-aware-layouts-with-has\u002Fhas-selector-performance\u002F",[1451,1452],"has",{},"() Selector Performance"," applies. A style query is paid when the queried property's computed value changes, which re-evaluates every rule inside the ",[14,1456,1293],{}," block for the container's descendants. A property toggled on hover near the root is as costly as a hover-driven ",[14,1459,16],{}," near the root.",[48,1462,1464],{"id":1463},"debugging-each-mechanism","Debugging each mechanism",[19,1466,1467],{},"The two features fail in characteristically different ways, and knowing the failure signature saves time.",[19,1469,1470,1471,1473,1474,1476,1477,1480,1481,1483,1484,1487,1488,354,1491,1494,1495,1498],{},"A ",[14,1472,16],{}," rule that does not apply almost always has a selector problem, and the Styles pane in any browser's DevTools shows it plainly: select the subject element and the rule is either listed (it matched) or absent (it did not). The usual culprits are a missing child combinator that makes the argument match somewhere unexpected, a pseudo-class that is not in the state you think — ",[14,1475,560],{}," on a radio in a different group, ",[14,1478,1479],{},":user-invalid"," before the user has interacted — and specificity, since ",[14,1482,16],{}," takes the weight of its most specific argument and can quietly outrank or lose to neighbouring rules. Toggle the element's state with the ",[14,1485,1486],{},":hov"," panel to force ",[14,1489,1490],{},":hover",[14,1492,1493],{},":focus"," or ",[14,1496,1497],{},":focus-visible"," and watch the rule appear.",[19,1500,1501,1502,1505,1506,1508,1509,1494,1511,1514,1515,1436,1517,1520,1521,1524,1525,1528],{},"A style query that does not apply almost always has a ",[30,1503,1504],{},"container"," problem. Chromium's Styles pane shows ",[14,1507,1293],{}," rules with the container they resolved against; if the query is attached to the wrong ancestor, or to none, that label says so. Check three things in order. Does an ancestor have a ",[14,1510,726],{},[14,1512,1513],{},"container-type"," that establishes it as a query container? Is the custom property set on that container or above it, rather than on the element being styled? And does the value match exactly? Style queries compare computed values, and an unregistered custom property's computed value is its token sequence, so ",[14,1516,155],{},[14,1518,1519],{},"--tone:alert"," match, but ",[14,1522,1523],{},"--tone: \"alert\""," with quotes does not match ",[14,1526,1527],{},"style(--tone: alert)",".",[19,1530,1531,1532,1534,1535,1537,1538,1540,1541,1543],{},"When a design system chains the two — discover with ",[14,1533,16],{},", publish as a property, read with ",[14,1536,1191],{}," — debug from the source outward. Confirm the ",[14,1539,16],{}," rule applies on the publishing element, then use the Computed pane on a descendant to confirm the property has inherited with the expected value, and only then look at the ",[14,1542,1293],{}," block. Working in that order finds the broken link in the chain in three clicks instead of ten.",[48,1545,1547],{"id":1546},"variation-themes-as-published-state","Variation: themes as published state",[19,1549,1550,1551,1554,1555,1557,1558,1560],{},"Theming is the canonical style-query use case, and it shows why published state scales better than discovery for values that come from above. A page section sets ",[14,1552,1553],{},"--surface: dark","; every component inside adapts, whether it is nested one level or ten. The same effect with ",[14,1556,16],{}," would require each component to find the section that set the theme, which is not what ",[14,1559,16],{}," does — it looks down, not up.",[198,1562,1564],{"className":1210,"code":1563,"language":1212,"meta":203,"style":203},".theme-dark { --surface: dark; }\n.theme-light { --surface: light; }\n\n\u002F* Any element can be the container for style queries. *\u002F\n.theme-dark, .theme-light { container-name: theme; }\n\n@container theme style(--surface: dark) {\n  .button { background: #e2e8f0; color: #0f172a; }\n  .card { background: #1e293b; color: #f1f5f9; }\n}\n",[14,1565,1566,1583,1599,1603,1608,1623,1627,1634,1660,1685],{"__ignoreMap":203},[207,1567,1568,1571,1573,1576,1578,1581],{"class":131,"line":209},[207,1569,1570],{"class":220},".theme-dark",[207,1572,330],{"class":212},[207,1574,1575],{"class":681},"--surface",[207,1577,336],{"class":212},[207,1579,1580],{"class":220},"dark",[207,1582,394],{"class":212},[207,1584,1585,1588,1590,1592,1594,1597],{"class":131,"line":227},[207,1586,1587],{"class":220},".theme-light",[207,1589,330],{"class":212},[207,1591,1575],{"class":681},[207,1593,336],{"class":212},[207,1595,1596],{"class":220},"light",[207,1598,394],{"class":212},[207,1600,1601],{"class":131,"line":247},[207,1602,401],{"emptyLinePlaceholder":400},[207,1604,1605],{"class":131,"line":257},[207,1606,1607],{"class":518},"\u002F* Any element can be the container for style queries. *\u002F\n",[207,1609,1610,1612,1614,1616,1618,1620],{"class":131,"line":275},[207,1611,1570],{"class":220},[207,1613,354],{"class":212},[207,1615,1587],{"class":220},[207,1617,330],{"class":212},[207,1619,726],{"class":220},[207,1621,1622],{"class":212},": theme; }\n",[207,1624,1625],{"class":131,"line":300},[207,1626,401],{"emptyLinePlaceholder":400},[207,1628,1629,1631],{"class":131,"line":314},[207,1630,1293],{"class":342},[207,1632,1633],{"class":212}," theme style(--surface: dark) {\n",[207,1635,1636,1639,1641,1643,1645,1648,1650,1653,1655,1658],{"class":131,"line":324},[207,1637,1638],{"class":220},"  .button",[207,1640,330],{"class":212},[207,1642,763],{"class":220},[207,1644,336],{"class":212},[207,1646,1647],{"class":220},"#e2e8f0",[207,1649,360],{"class":212},[207,1651,1652],{"class":220},"color",[207,1654,336],{"class":212},[207,1656,1657],{"class":220},"#0f172a",[207,1659,394],{"class":212},[207,1661,1662,1665,1667,1669,1671,1674,1676,1678,1680,1683],{"class":131,"line":397},[207,1663,1664],{"class":220},"  .card",[207,1666,330],{"class":212},[207,1668,763],{"class":220},[207,1670,336],{"class":212},[207,1672,1673],{"class":220},"#1e293b",[207,1675,360],{"class":212},[207,1677,1652],{"class":220},[207,1679,336],{"class":212},[207,1681,1682],{"class":220},"#f1f5f9",[207,1684,394],{"class":212},[207,1686,1687],{"class":131,"line":404},[207,1688,1263],{"class":212},[19,1690,1691,1692,1696,1697,1701],{},"The full treatment, including nested themes and fallbacks, is in ",[23,1693,1695],{"href":1694},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state\u002Fcontainer-style-query-theming\u002F","Container Style Query Theming",". If the theme should animate as it changes, registered custom properties make the transition smooth; ",[23,1698,1700],{"href":1699},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture\u002Fanimating-custom-properties-with-at-property\u002F","Animating Custom Properties With @property"," explains why an unregistered property cannot interpolate.",[48,1703,1705],{"id":1704},"browser-support","Browser support",[19,1707,1708,1710,1711,1713,1714,1718,1719,1722],{},[14,1709,16],{}," ships in Chrome and Edge 105+, Firefox 121+ and Safari 15.4+. Style queries for custom properties ship in Chrome and Edge 111+, Firefox 151+ and Safari 18+, so they are the newer and less universally deployed of the two. For a style-query-based variant, keep a sensible default outside the ",[14,1712,1293],{}," block and treat the query as an enhancement; ",[23,1715,1717],{"href":1716},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state\u002Fstyle-query-fallbacks-and-support\u002F","Style Query Fallbacks and Support"," covers detection with ",[14,1720,1721],{},"@supports"," and graceful defaults.",[48,1724,1726],{"id":1725},"faq","FAQ",[19,1728,1729,1736],{},[1730,1731,1732,1733,1735],"strong",{},"Can a style query replace ",[14,1734,16],{},"?","\nOnly when the state can be expressed as a custom property on an ancestor. Style queries read computed values, so they cannot see whether a child element exists, whether an input is checked, or whether something is hovered, unless some rule has already turned that into a property.",[19,1738,1739,1745,1746,1748],{},[1730,1740,1741,1742,1744],{},"Can ",[14,1743,16],{}," replace a style query?","\nFor state that lives in the DOM, yes. For state that is inherited through custom properties from far above, such as a theme token set on a section wrapper, ",[14,1747,16],{}," would need to find the element that set it, which is fragile. Style queries read the inherited value directly.",[19,1750,1751,1754],{},[1730,1752,1753],{},"Why does my style query not match a property set on the element itself?","\nA style query evaluates the custom property on the query container, which is an ancestor, not on the element being styled. Set the property on the container or anything above it and query it from descendants. An element cannot query its own style.",[19,1756,1757,1760,1761,1763],{},[1730,1758,1759],{},"Which one is faster?","\nNeither is categorically faster. ",[14,1762,16],{}," pays when its argument changes and cost grows with the breadth of the anchor. A style query pays when the queried property changes and every descendant rule that depends on it must be re-evaluated. Measure the specific case when it matters.",[48,1765,1767],{"id":1766},"related","Related",[1769,1770,1771,1781,1788,1797],"ul",{},[1772,1773,1774,1780],"li",{},[23,1775,1776,1777,1779],{"href":25},"Parent-Aware Layouts With ",[1451,1778],{},"()"," — the parent guide to relational selectors.",[1772,1782,1783,1787],{},[23,1784,1786],{"href":1785},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state\u002Fstyle-queries-with-custom-properties\u002F","Style Queries With Custom Properties"," — the syntax of style() in depth.",[1772,1789,1790,1796],{},[23,1791,1793,1794,1779],{"href":1792},"\u002Fmastering-container-queries-responsive-layouts\u002Fparent-aware-layouts-with-has\u002Fcontent-aware-card-layouts-with-has\u002F","Content-Aware Card Layouts With ",[1451,1795],{}," — discovery used for component variants.",[1772,1798,1799,1803],{},[23,1800,1802],{"href":1801},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture\u002Fregistered-properties-and-type-safety\u002F","Registered Properties and Type Safety"," — making published state typed and animatable.",[319,1805,1806],{},"html pre.shiki code .suds8, html code.shiki .suds8{--shiki-default:#0E1116;--shiki-dark:#F0F3F6}html pre.shiki code .sne4z, html code.shiki .sne4z{--shiki-default:#024C1A;--shiki-dark:#72F088}html pre.shiki code .s-5SL, html code.shiki .s-5SL{--shiki-default:#023B95;--shiki-dark:#91CBFF}html pre.shiki code .sT6z2, html code.shiki .sT6z2{--shiki-default:#032563;--shiki-dark:#ADDCFF}html pre.shiki code .sHUrx, html code.shiki .sHUrx{--shiki-default:#A0111F;--shiki-dark:#FF9492}html pre.shiki code .sLBg1, html code.shiki .sLBg1{--shiki-default:#66707B;--shiki-dark:#BDC4CC}html pre.shiki code .soyes, html code.shiki .soyes{--shiki-default:#702C00;--shiki-dark:#FFB757}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":203,"searchDepth":227,"depth":227,"links":1808},[1809,1810,1811,1812,1813,1814,1815,1816,1817],{"id":50,"depth":227,"text":51},{"id":188,"depth":227,"text":189},{"id":1085,"depth":227,"text":1086},{"id":1336,"depth":227,"text":1337},{"id":1463,"depth":227,"text":1464},{"id":1546,"depth":227,"text":1547},{"id":1704,"depth":227,"text":1705},{"id":1725,"depth":227,"text":1726},{"id":1766,"depth":227,"text":1767},"Two ways for a component to react to state: discovered with :has() or published with a custom property and style query. Scope, inheritance and cost compared.","md",{"pageTitle":1821,"datePublished":1822,"dateModified":1822,"faq":1823},":has() vs Container Style Queries","2026-09-18",[1824,1827,1830,1832],{"q":1825,"a":1826},"Can a style query replace :has()?","Only when the state can be expressed as a custom property on an ancestor. Style queries read computed values, so they cannot see whether a child element exists, whether an input is checked, or whether something is hovered, unless some rule has already turned that into a property.",{"q":1828,"a":1829},"Can :has() replace a style query?","For state that lives in the DOM, yes. For state that is inherited through custom properties from far above, such as a theme token set on a section wrapper, :has() would need to find the element that set it, which is fragile. Style queries read the inherited value directly.",{"q":1753,"a":1831},"A style query evaluates the custom property on the query container, which is an ancestor, not on the element being styled. Set the property on the container or anything above it and query it from descendants. An element cannot query its own style.",{"q":1759,"a":1833},"Neither is categorically faster. :has() pays when its argument changes and cost grows with the breadth of the anchor. A style query pays when the queried property changes and every descendant rule that depends on it must be re-evaluated. Measure the specific case when it matters.","\u002Fmastering-container-queries-responsive-layouts\u002Fparent-aware-layouts-with-has\u002Fhas-vs-container-style-queries",{"title":5,"description":1818},"mastering-container-queries-responsive-layouts\u002Fparent-aware-layouts-with-has\u002Fhas-vs-container-style-queries\u002Findex","o22SXeo0hR-ZQ-NoecH0CpY883UcNZYZP_jyhE88QB8",[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,1998,2001,2004,2007,2010,2013,2016,2019,2022,2025,2028,2031,2034,2037,2040,2043,2046,2049,2052,2055,2058,2061,2064,2067,2070,2073,2076,2079,2082,2085,2088,2091,2094,2097,2100,2103,2106,2109,2112,2115,2118,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,2260,2263,2266,2269,2272,2275,2278,2281,2284,2287,2290,2293,2296,2299,2302,2305,2308,2311,2312,2315,2318,2321,2324,2327,2330,2333,2336,2339,2342,2345,2348,2351,2354,2357,2360,2363,2366,2369,2372,2375,2378,2381,2384,2387,2390,2393],{"path":1840,"title":1841},"\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":1843,"title":1844},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fflashing-content-and-seizure-thresholds","Flashing Content and Seizure Thresholds",{"path":1846,"title":1847},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fforced-colors-mode-and-animations","Forced Colors Mode and Animations",{"path":1849,"title":1850},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations","Accessibility in CSS Animations: Patterns, Specs & Best Practices",{"path":1852,"title":1853},"\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":1855,"title":1856},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fprefers-reduced-motion-recipes","prefers-reduced-motion Recipes: A Reduction for Every Common Effect",{"path":1858,"title":1859},"\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":1861,"title":1862},"\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":1864,"title":1865},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fvestibular-safe-animation-patterns","Vestibular-Safe Animation Patterns: Why Some Motion Makes People Sick",{"path":1867,"title":1868},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fwcag-motion-success-criteria","WCAG Motion Success Criteria: What Each One Actually Requires",{"path":1870,"title":1871},"\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":1873,"title":1874},"\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":1876,"title":1877},"\u002Fcss-only-micro-interactions-animations\u002Fclip-path-and-mask-animations","Clip-Path & Mask Animations: Animating Visibility Instead of Position",{"path":1879,"title":1880},"\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":1882,"title":1883},"\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":1885,"title":1886},"\u002Fcss-only-micro-interactions-animations\u002Fcolor-and-theme-transitions\u002Fanimating-gradients","Animating CSS Gradients: Smooth Colour Motion Without Jumps",{"path":1888,"title":1889},"\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":1891,"title":1892},"\u002Fcss-only-micro-interactions-animations\u002Fcolor-and-theme-transitions","Color & Theme Transitions: Colour as Part of the Motion System",{"path":1894,"title":1895},"\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":1897,"title":1898},"\u002Fcss-only-micro-interactions-animations\u002Fcolor-and-theme-transitions\u002Fsmooth-theme-switching-transitions","Smooth Theme Switching: Crossfades, Circular Reveals and No Flash",{"path":1900,"title":1901},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion\u002Fcontainer-query-hover-affordances","Container Query Hover Affordances: When Narrow Means Persistent, Not Hidden",{"path":1903,"title":1904},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion","Container-Aware Motion: Animation Sized by the Space a Component Actually Has",{"path":1906,"title":1907},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion\u002Flayout-change-animations-at-container-breakpoints","Animating Changes at Container Breakpoints",{"path":1909,"title":1910},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion\u002Fmotion-driven-by-container-style-queries","Motion Driven by Container Style Queries",{"path":1912,"title":1913},"\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":1915,"title":1916},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion\u002Fsuppressing-motion-in-small-containers","Suppressing Motion in Small Containers: Deliberately Animating Nothing",{"path":1918,"title":1919},"\u002Fcss-only-micro-interactions-animations\u002Fcss-animation-vs-web-animations-api\u002Fcontrolling-css-animations-from-javascript","Controlling CSS Animations From JavaScript",{"path":1921,"title":1922},"\u002Fcss-only-micro-interactions-animations\u002Fcss-animation-vs-web-animations-api","CSS Animation vs the Web Animations API: A Decision Guide",{"path":1924,"title":1925},"\u002Fcss-only-micro-interactions-animations\u002Fcss-animation-vs-web-animations-api\u002Fwaapi-vs-css-for-interruptible-ui","Interruptible UI: CSS Transitions vs WAAPI",{"path":1927,"title":1928},"\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":1930,"title":1931},"\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":1933,"title":1934},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture\u002Fcustom-property-fallbacks-and-invalid-values","Custom Property Fallbacks and Invalid Values",{"path":1936,"title":1937},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture\u002Ffluid-spacing-tokens-driving-transition-durations","Fluid Spacing Tokens That Drive Transition Durations",{"path":1939,"title":1940},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture","CSS Custom Properties Architecture: Scalable Design Systems & Dynamic UI",{"path":1942,"title":1943},"\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":1945,"title":1946},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture\u002Fscoping-custom-properties-to-components","Scoping Custom Properties to Components",{"path":1948,"title":1949},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Fcss-transition-timing-functions","CSS Transition Timing Functions: ease, cubic-bezier(), steps() and linear()",{"path":1951,"title":1952},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals","CSS Transition Fundamentals: Architecture, Performance & Patterns",{"path":1954,"title":1955},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Finterrupted-and-reversing-transitions","Interrupted and Reversing Transitions: What Happens Mid-Flight",{"path":1957,"title":1958},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Fstarting-style-entry-animations","@starting-style: Animating an Element's Very First Style Change",{"path":1960,"title":1961},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Ftransition-delay-choreography","Choreographing Motion With transition-delay",{"path":1963,"title":1964},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Ftransition-shorthand-and-multiple-properties","The transition Shorthand and Multiple Properties",{"path":1966,"title":1967},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Ftransitioning-display-with-allow-discrete","Transitioning display with transition-behavior: allow-discrete and @starting-style",{"path":1969,"title":1970},"\u002Fcss-only-micro-interactions-animations\u002Fdialog-and-popover-animations\u002Fanimating-dialog-open-and-close","Animating \u003Cdialog> Open and Close: Both Directions, No Library",{"path":1972,"title":1973},"\u002Fcss-only-micro-interactions-animations\u002Fdialog-and-popover-animations\u002Fbackdrop-animations","Animating ::backdrop: Fades and Blurs Behind Dialogs and Popovers",{"path":1975,"title":1976},"\u002Fcss-only-micro-interactions-animations\u002Fdialog-and-popover-animations","Dialog & Popover Animations: Motion for the Top Layer",{"path":1978,"title":1979},"\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":1981,"title":1982},"\u002Fcss-only-micro-interactions-animations\u002Fdialog-and-popover-animations\u002Fpopover-entry-and-exit-transitions","Popover Menus That Animate From Their Anchor",{"path":1984,"title":1985},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design\u002Fchoosing-animation-durations","Choosing Animation Durations: How Long Motion Should Last",{"path":1987,"title":1988},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design\u002Fcubic-bezier-overshoot-and-anticipation","Overshoot and Anticipation With cubic-bezier(): Motion With Character",{"path":1990,"title":1991},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design\u002Fentry-vs-exit-easing","Entry vs Exit Easing: Different Curves for Arriving and Leaving",{"path":1993,"title":1994},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design","Easing & Motion Design: Making CSS Motion Feel Intentional",{"path":1996,"title":1997},"\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":1999,"title":2000},"\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":2002,"title":2003},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design\u002Faccessible-css-only-tooltips","Accessible CSS-Only Tooltips and Hover Cards With  and ",{"path":2005,"title":2006},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design\u002Fbutton-press-and-active-states","Button Press and  States",{"path":2008,"title":2009},"\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":2011,"title":2012},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design\u002Ffocus-within-form-patterns"," Form Patterns: Styling a Group From the Field Inside It",{"path":2014,"title":2015},"\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":2017,"title":2018},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design","Hover & Focus State Design: Spec-Compliant Patterns for Modern UIs",{"path":2020,"title":2021},"\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":2023,"title":2024},"\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":2026,"title":2027},"\u002Fcss-only-micro-interactions-animations","CSS-Only Micro-Interactions & Animations: Architecture, Performance & Implementation",{"path":2029,"title":2030},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fanimation-composition-and-stacking","Stacking Animations With animation-composition",{"path":2032,"title":2033},"\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":2035,"title":2036},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fcontainer-query-triggered-keyframe-animations","Container-Query-Triggered Keyframe Animations: Animate Differently per Available Space",{"path":2038,"title":2039},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fcss-only-accordions-and-disclosure","CSS-Only Accordions and Disclosure Widgets with details and summary",{"path":2041,"title":2042},"\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":2044,"title":2045},"\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":2047,"title":2048},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns","Keyframe Animation Patterns: Spec-Compliant Architectures for Modern UIs",{"path":2050,"title":2051},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fmulti-step-keyframes-and-per-keyframe-easing","Multi-Step Keyframes and Per-Keyframe Easing",{"path":2053,"title":2054},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fstaggered-list-animations-with-custom-properties","Staggered List Animations Using --i Index Custom Properties",{"path":2056,"title":2057},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Fanimating-box-shadow-and-filters-cheaply","Animating box-shadow and Filters Cheaply",{"path":2059,"title":2060},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Fcontain-property-for-animation-performance","The contain Property for Animation Performance",{"path":2062,"title":2063},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Fcss-triggers-layout-paint-composite","Layout, Paint and Composite: What Triggers What",{"path":2065,"title":2066},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration","Performance & GPU Acceleration in CSS: A Developer’s Blueprint",{"path":2068,"title":2069},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Foptimizing-css-animations-for-60fps","Optimizing CSS Animations for 60fps: Budgeting the Frame",{"path":2071,"title":2072},"\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":2074,"title":2075},"\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":2077,"title":2078},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations","Scroll-Driven Animations: Binding Motion to Scroll Position in Pure CSS",{"path":2080,"title":2081},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fscroll-driven-animation-fallbacks","Shipping Scroll-Driven Animations Without Breaking Anything",{"path":2083,"title":2084},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fscroll-driven-parallax-effects","Scroll-Driven Parallax Effects in CSS",{"path":2086,"title":2087},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fscroll-progress-bar-without-javascript","A Reading Progress Bar Driven by scroll(root)",{"path":2089,"title":2090},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fscroll-triggered-reveal-animations","Reveal-on-Scroll with view() and animation-range",{"path":2092,"title":2093},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Ftimeline-scope-for-cross-element-animations","timeline-scope for Cross-Element Animations",{"path":2095,"title":2096},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fview-timeline-and-animation-range","View Timelines and animation-range",{"path":2098,"title":2099},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fcross-document-view-transitions","Cross-Document View Transitions",{"path":2101,"title":2102},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers","View Transitions for CSS Developers: the Pseudo-Element Tree, Snapshots, and Named Elements",{"path":2104,"title":2105},"\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":2107,"title":2108},"\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":2110,"title":2111},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fview-transition-types-and-classes","View Transition Types and Classes",{"path":2113,"title":2114},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fview-transitions-for-list-reordering","View Transitions for List Reordering",{"path":2116,"title":2117},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fview-transitions-with-reduced-motion","Honouring prefers-reduced-motion in View Transitions",{"path":346,"title":2119},"Modern CSS Layouts & Micro-Interactions",{"path":2121,"title":2122},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fanchor-positioned-tooltips","Anchor-Positioned Tooltips: Tethering, Flipping, and Getting the Semantics Right",{"path":2124,"title":2125},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fanchor-positioning-fallbacks","Anchor Positioning Fallbacks: A Graceful Floor for Older Browser Versions",{"path":2127,"title":2128},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fanchor-size-for-matching-widths","anchor-size(): Overlays That Match Their Trigger's Size",{"path":2130,"title":2131},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays","CSS Anchor Positioning and Overlays: Tethering Elements Without JavaScript",{"path":2133,"title":2134},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fpopover-attribute-and-css-styling","The popover Attribute: Top-Layer Overlays With No JavaScript",{"path":2136,"title":2137},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fpopover-light-dismiss-and-stacking","Popover Light Dismiss, Nesting and Stacking",{"path":2139,"title":2140},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fposition-area-grid-explained","position-area: The Anchor Placement Grid",{"path":2142,"title":2143},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Fcontainer-query-polyfill-tradeoffs","Container Query Polyfills: What They Cost and When to Skip Them",{"path":2145,"title":2146},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Ffeature-detection-with-supports","Feature Detection with @supports: Syntax, Semantics, and the Traps",{"path":2148,"title":2149},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Fhandling-container-query-fallbacks-for-older-browsers","Handling Container Query Fallbacks for Older Browsers",{"path":2151,"title":2152},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks","Container Query Fallbacks: Spec-Compliant CSS Strategies for Legacy Browsers",{"path":2154,"title":2155},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Fintrinsic-layout-fallbacks-without-queries","Intrinsic Layout Fallbacks: Baselines That Adapt Without Any Query",{"path":2157,"title":2158},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Ftesting-fallbacks-without-old-browsers","Testing CSS Fallbacks Without an Old Browser",{"path":2160,"title":2161},"\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":2163,"title":2164},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fcontainer-query-range-and-logic-operators","Container Query Range Syntax and Logic Operators",{"path":2166,"title":2167},"\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":2169,"title":2170},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fcontainer-type-size-vs-inline-size","Choosing container-type: inline-size, size, or normal",{"path":2172,"title":2173},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fcontainer-vs-media-queries-comparison","Container vs Media Queries: Choosing the Right Reference Box",{"path":2175,"title":2176},"\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":2178,"title":2179},"\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":2181,"title":2182},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics","Container Query Syntax Basics",{"path":2184,"title":2185},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fnesting-and-naming-container-queries","Nesting and Naming Container Queries: Targeting the Right Ancestor",{"path":2187,"title":2188},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fauto-fit-minmax-responsive-grids","Responsive Grids with repeat(auto-fit, minmax())",{"path":2190,"title":2191},"\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":2193,"title":2194},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fgrid-auto-flow-dense-packing","grid-auto-flow: dense for Packed Layouts",{"path":2196,"title":2197},"\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":2199,"title":2200},"\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":2202,"title":2203},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts","CSS Grid and Subgrid Layouts for Responsive Interfaces",{"path":2205,"title":2206},"\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":2208,"title":2209},"\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":2211,"title":2212},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fsubgrid-vs-nested-grid","Subgrid vs an Independently Nested Grid",{"path":2214,"title":2215},"\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":2217,"title":2218},"\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":2220,"title":2221},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fflex-grow-and-flex-shrink-explained","flex-grow and flex-shrink Explained",{"path":2223,"title":2224},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fflex-wrap-intrinsic-responsive-rows","Breakpoint-Free Responsive Rows With flex-wrap and flex-basis",{"path":2226,"title":2227},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fflexbox-gap-and-spacing","Flexbox gap vs Margins: Spacing Items Without Edge Hacks",{"path":2229,"title":2230},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns","Flexbox Layout Patterns: One-Dimensional Layout for Real Components",{"path":2232,"title":2233},"\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":2235,"title":2236},"\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":2238,"title":2239},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp\u002Fdebugging-clamp-values","Debugging clamp(): Values That Are Ignored, Stuck or Never Fluid",{"path":2241,"title":2242},"\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":2244,"title":2245},"\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":2247,"title":2248},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp\u002Ffluid-type-accessibility-and-zoom","Fluid Type, Accessibility and Zoom: The vw-Only Trap",{"path":2250,"title":2251},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp\u002Ffluid-typography-without-javascript","Fluid Typography Without JavaScript: A Precision CSS Reference",{"path":2253,"title":2254},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp","Fluid Typography with clamp(): A Practical Guide for Modern CSS",{"path":2256,"title":2257},"\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":2259,"title":45},"\u002Fmastering-container-queries-responsive-layouts",{"path":2261,"title":2262},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Faspect-ratio-for-responsive-media","Using aspect-ratio for Responsive Media and Preventing Layout Shift",{"path":2264,"title":2265},"\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":2267,"title":2268},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques","Intrinsic Sizing Techniques: Modern CSS Layouts for Responsive UI",{"path":2270,"title":2271},"\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":2273,"title":2274},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Fmin-max-fit-content-explained","min-content, max-content, and fit-content() Explained",{"path":2276,"title":2277},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Fobject-fit-and-object-position","object-fit and object-position: Images That Fit Any Box",{"path":2279,"title":2280},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Fpreventing-flex-and-grid-overflow","The min-width: auto Trap in Flex and Grid Layouts",{"path":2282,"title":2283},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies\u002Fcascade-layers-for-reset-and-tokens","Cascade Layers for Reset and Design Tokens",{"path":2285,"title":2286},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies\u002Fcascade-layers-vs-specificity-hacks","Cascade Layers vs Specificity Hacks: Ordering Instead of Escalating",{"path":2288,"title":2289},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies\u002Fcss-scope-for-component-styles","@scope for Component Styles: Short Selectors That Cannot Leak",{"path":2291,"title":2292},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies","Modern CSS Reset Strategies: A Spec-Compliant Foundation",{"path":2294,"title":2295},"\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":2297,"title":2298},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies\u002Fwriting-a-minimal-modern-reset","Writing a Minimal Modern CSS Reset: Every Line Justified",{"path":2300,"title":2301},"\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":2303,"title":2304},"\u002Fmastering-container-queries-responsive-layouts\u002Fparent-aware-layouts-with-has\u002Fempty-and-loading-states-with-has","Empty and Loading States With ()",{"path":2306,"title":2307},"\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":2309,"title":2310},"\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":1834,"title":5},{"path":2313,"title":2314},"\u002Fmastering-container-queries-responsive-layouts\u002Fparent-aware-layouts-with-has","Parent-Aware Layouts With :has(): Letting Containers React to Their Contents",{"path":2316,"title":2317},"\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":2319,"title":2320},"\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":2322,"title":2323},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fcontainer-query-data-tables","Container Query Data Tables: Reflowing Tables to Cards",{"path":2325,"title":2326},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fcontainer-query-sidebar-layouts","Container Query Sidebar Layouts That Travel Between Contexts",{"path":2328,"title":2329},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns","Responsive Component Patterns: Architecture & Implementation",{"path":2331,"title":2332},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fresponsive-forms-with-container-queries","Responsive Forms with Container Queries: Reflow Without Losing the Wiring",{"path":2334,"title":2335},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fresponsive-hero-sections-with-container-queries","Responsive Hero Sections With Container Queries",{"path":2337,"title":2338},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fresponsive-navigation-without-media-queries","Responsive Navigation Without Media Queries Using Container Queries",{"path":2340,"title":2341},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fresponsive-pricing-tables","Responsive Pricing Tables: Aligned Features, a Clear Recommendation, Any Width",{"path":2343,"title":2344},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Ftabs-that-become-accordions","Tabs That Become an Accordion: One Component, Two Layouts",{"path":2346,"title":2347},"\u002Fmastering-container-queries-responsive-layouts\u002Fscroll-snap-and-overflow-layouts\u002Fcss-only-carousel-with-scroll-snap","A CSS-Only Carousel With Scroll Snap",{"path":2349,"title":2350},"\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":2352,"title":2353},"\u002Fmastering-container-queries-responsive-layouts\u002Fscroll-snap-and-overflow-layouts","Scroll Snap & Overflow Layouts: Designing Components That Scroll on Purpose",{"path":2355,"title":2356},"\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":2358,"title":2359},"\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":2361,"title":2362},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state\u002Fcombining-size-and-style-queries","Combining Size and Style Container Queries",{"path":2364,"title":2365},"\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":2367,"title":2368},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state","Style Queries and Container State: Token-Driven Component Variants",{"path":2370,"title":2371},"\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":2373,"title":2374},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state\u002Fstyle-query-component-variants","Component Variants With Style Queries: One Token, Many Looks",{"path":2376,"title":2377},"\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":2379,"title":2380},"\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":2382,"title":2383},"\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":2385,"title":2386},"\u002Fmastering-container-queries-responsive-layouts\u002Fviewport-units-and-mobile-layout","Viewport Units & Mobile Layout: Designing for the Screen You Actually Get",{"path":2388,"title":2389},"\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":2391,"title":2392},"\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":2394,"title":2395},"\u002Fmastering-container-queries-responsive-layouts\u002Fviewport-units-and-mobile-layout\u002Fvirtual-keyboard-and-interactive-widget","Layouts That Survive the Virtual Keyboard",1789717746395]