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