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