[{"data":1,"prerenderedAt":1320},["ShallowReactive",2],{"page-\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fgrid-auto-flow-dense-packing\u002F":3,"content-all-pages":755,"live-demo:grid-dense-toggle":1314},{"id":4,"title":5,"body":6,"description":738,"extension":739,"meta":740,"navigation":337,"path":751,"seo":752,"stem":753,"__hash__":754},"content\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fgrid-auto-flow-dense-packing\u002Findex.md","grid-auto-flow: dense for Packed Layouts",{"type":7,"value":8,"toc":725},"minimark",[9,13,33,38,54,171,175,188,192,195,199,467,481,485,488,545,548,552,563,573,577,580,584,587,625,633,637,643,647,663,667,673,679,685,691,695,721],[10,11,5],"h1",{"id":12},"grid-auto-flow-dense-for-packed-layouts",[14,15,16,17,21,22,27,28,32],"p",{},"Auto-placement is one of CSS Grid's best features: list the items, define the tracks, and the browser puts each item into the next free cell. Add some items that span two columns or two rows — a featured card, a wide photo — and a problem appears. When a spanning item does not fit in the remaining space of a row, it wraps to the next row and leaves a hole behind it. The default algorithm never goes back to fill that hole. ",[18,19,20],"code",{},"grid-auto-flow: dense"," changes that: the browser backfills earlier gaps with later, smaller items, producing a tightly packed grid. This page explains both algorithms, shows dense packing in action, and covers the accessibility cost that decides when to use it. It belongs to ",[23,24,26],"a",{"href":25},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002F","CSS Grid & Subgrid Layouts"," in the ",[23,29,31],{"href":30},"\u002Fmastering-container-queries-responsive-layouts\u002F","Mastering Container Queries & Responsive Layouts"," guide.",[34,35,37],"h2",{"id":36},"sparse-placement-the-cursor-only-moves-forward","Sparse placement: the cursor only moves forward",[14,39,40,41,44,45,48,49,53],{},"By default, ",[18,42,43],{},"grid-auto-flow"," is ",[18,46,47],{},"row"," — the ",[50,51,52],"em",{},"sparse"," algorithm. The browser keeps a placement cursor. For each item in source order, it moves the cursor forward until it finds a spot where the item fits, places it, and continues from there. It never moves the cursor backwards. A 2-column-wide item that meets a single free cell at the end of a row skips to the next row, and that single cell stays empty forever, because every later item is placed after the wide one.",[55,56,62,63,62,67,62,71,62,79,62,85,62,89,62,97,62,100,62,109,62,113,62,115,62,118,62,123,62,126,62,131,62,136,62,138,62,141,62,144,62,147,62,150,62,152,62,154,62,157,62,159,62,162,62,165,62,167],"svg",{"viewBox":57,"role":58,"ariaLabel":59,"xmlns":60,"style":61},"0 0 720 300","img","A three-column grid with sparse placement: a wide item skips to the next row leaving an empty cell; with dense placement, a later single-cell item fills that hole","http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg","width:100%;height:auto;max-width:720px;margin:2rem 0","\n  ",[64,65,66],"title",{},"Sparse leaves holes; dense backfills them",[68,69,70],"desc",{},"Left grid, sparse: items 1 and 2 fill the first two cells of row one. Item 3 spans two columns, does not fit in the last cell, and moves to row two, leaving the third cell of row one empty. Items 4 and 5 follow after item 3. Right grid, dense: the same items, but item 4 moves back to fill the empty third cell of row one.",[72,73,78],"text",{"textAnchor":74,"x":75,"y":76,"style":77},"middle","360","26","text-anchor:middle;fill:currentColor;font:700 17px sans-serif","Same five items, two algorithms",[72,80,84],{"textAnchor":74,"x":81,"y":82,"style":83},"185","56","text-anchor:middle;fill:currentColor;font:600 13px ui-monospace,monospace","row (sparse)",[72,86,88],{"textAnchor":74,"x":87,"y":82,"style":83},"535","row dense",[90,91],"rect",{"x":92,"y":92,"width":92,"height":93,"rx":94,"fill":95,"opacity":96},"70","60","6","#7aa2ff","0.4",[90,98],{"x":99,"y":92,"width":92,"height":93,"rx":94,"fill":95,"opacity":96},"150",[90,101],{"x":102,"y":92,"width":92,"height":93,"rx":94,"fill":103,"stroke":104,"strokeWidth":105,"strokeDashArray":106},"230","none","currentColor","1.5",[107,108],"5","4",[90,110],{"x":92,"y":111,"width":99,"height":93,"rx":94,"fill":95,"opacity":112},"140","0.65",[90,114],{"x":102,"y":111,"width":92,"height":93,"rx":94,"fill":95,"opacity":96},[90,116],{"x":92,"y":117,"width":92,"height":93,"rx":94,"fill":95,"opacity":96},"210",[72,119,122],{"textAnchor":74,"x":120,"y":120,"style":121},"105","text-anchor:middle;fill:currentColor;font:600 14px sans-serif","1",[72,124,125],{"textAnchor":74,"x":81,"y":120,"style":121},"2",[72,127,130],{"textAnchor":74,"x":128,"y":120,"style":129},"265","text-anchor:middle;fill:currentColor;font:11px sans-serif","empty",[72,132,135],{"textAnchor":74,"x":133,"y":134,"style":121},"145","175","3 (wide)",[72,137,108],{"textAnchor":74,"x":128,"y":134,"style":121},[72,139,107],{"textAnchor":74,"x":120,"y":140,"style":121},"245",[90,142],{"x":143,"y":92,"width":92,"height":93,"rx":94,"fill":95,"opacity":96},"420",[90,145],{"x":146,"y":92,"width":92,"height":93,"rx":94,"fill":95,"opacity":96},"500",[90,148],{"x":149,"y":92,"width":92,"height":93,"rx":94,"fill":95,"opacity":96},"580",[90,151],{"x":143,"y":111,"width":99,"height":93,"rx":94,"fill":95,"opacity":112},[90,153],{"x":149,"y":111,"width":92,"height":93,"rx":94,"fill":95,"opacity":96},[72,155,122],{"textAnchor":74,"x":156,"y":120,"style":121},"455",[72,158,125],{"textAnchor":74,"x":87,"y":120,"style":121},[72,160,108],{"textAnchor":74,"x":161,"y":120,"style":121},"615",[72,163,135],{"textAnchor":74,"x":164,"y":134,"style":121},"495",[72,166,107],{"textAnchor":74,"x":161,"y":134,"style":121},[72,168,170],{"textAnchor":74,"x":87,"y":140,"style":169},"text-anchor:middle;fill:currentColor;font:12px sans-serif","no hole, but 4 now precedes 3",[34,172,174],{"id":173},"dense-placement-search-from-the-start-for-each-item","Dense placement: search from the start for each item",[14,176,177,178,180,181,183,184,187],{},"With ",[18,179,20],{}," (or ",[18,182,88],{},"), the algorithm resets the cursor to the start of the grid for every item and places it in the ",[50,185,186],{},"first"," spot where it fits. Items that fit into earlier holes go there, even though they come later in the source. The result is a packed grid with no gaps, as long as there are small enough items to fill them.",[34,189,191],{"id":190},"the-complete-implementation","The complete implementation",[14,193,194],{},"The demo shows a photo mosaic where some tiles span two columns or two rows. Tick the checkbox to switch between sparse and dense placement and watch the holes disappear.",[196,197],"live-demo",{"name":198},"grid-dense-toggle",[200,201,206],"pre",{"className":202,"code":203,"language":204,"meta":205,"style":205},"language-css shiki shiki-themes github-light-high-contrast github-dark-high-contrast",".mosaic {\n  display: grid;\n  grid-template-columns: repeat(auto-fill, minmax(6rem, 1fr));\n  grid-auto-rows: 6rem;\n  gap: 0.5rem;\n  grid-auto-flow: row dense;   \u002F* backfill holes left by spanning tiles *\u002F\n}\n\n.mosaic__tile--wide { grid-column: span 2; }\n.mosaic__tile--tall { grid-row: span 2; }\n.mosaic__tile--big  { grid-column: span 2; grid-row: span 2; }\n\n.mosaic__tile img {\n  inline-size: 100%;\n  block-size: 100%;\n  object-fit: cover;\n}\n","css","",[18,207,208,221,236,277,291,306,326,332,339,359,376,402,407,419,435,449,462],{"__ignoreMap":205},[209,210,213,217],"span",{"class":211,"line":212},"line",1,[209,214,216],{"class":215},"s-5SL",".mosaic",[209,218,220],{"class":219},"suds8"," {\n",[209,222,224,227,230,233],{"class":211,"line":223},2,[209,225,226],{"class":215},"  display",[209,228,229],{"class":219},": ",[209,231,232],{"class":215},"grid",[209,234,235],{"class":219},";\n",[209,237,239,242,244,247,250,253,256,259,261,263,267,269,271,274],{"class":211,"line":238},3,[209,240,241],{"class":215},"  grid-template-columns",[209,243,229],{"class":219},[209,245,246],{"class":215},"repeat",[209,248,249],{"class":219},"(",[209,251,252],{"class":215},"auto-fill",[209,254,255],{"class":219},", ",[209,257,258],{"class":215},"minmax",[209,260,249],{"class":219},[209,262,94],{"class":215},[209,264,266],{"class":265},"sHUrx","rem",[209,268,255],{"class":219},[209,270,122],{"class":215},[209,272,273],{"class":265},"fr",[209,275,276],{"class":219},"));\n",[209,278,280,283,285,287,289],{"class":211,"line":279},4,[209,281,282],{"class":215},"  grid-auto-rows",[209,284,229],{"class":219},[209,286,94],{"class":215},[209,288,266],{"class":265},[209,290,235],{"class":219},[209,292,294,297,299,302,304],{"class":211,"line":293},5,[209,295,296],{"class":215},"  gap",[209,298,229],{"class":219},[209,300,301],{"class":215},"0.5",[209,303,266],{"class":265},[209,305,235],{"class":219},[209,307,309,312,314,316,319,322],{"class":211,"line":308},6,[209,310,311],{"class":215},"  grid-auto-flow",[209,313,229],{"class":219},[209,315,47],{"class":215},[209,317,318],{"class":215}," dense",[209,320,321],{"class":219},";   ",[209,323,325],{"class":324},"sLBg1","\u002F* backfill holes left by spanning tiles *\u002F\n",[209,327,329],{"class":211,"line":328},7,[209,330,331],{"class":219},"}\n",[209,333,335],{"class":211,"line":334},8,[209,336,338],{"emptyLinePlaceholder":337},true,"\n",[209,340,342,345,348,351,354,356],{"class":211,"line":341},9,[209,343,344],{"class":215},".mosaic__tile--wide",[209,346,347],{"class":219}," { ",[209,349,350],{"class":215},"grid-column",[209,352,353],{"class":219},": span ",[209,355,125],{"class":215},[209,357,358],{"class":219},"; }\n",[209,360,362,365,367,370,372,374],{"class":211,"line":361},10,[209,363,364],{"class":215},".mosaic__tile--tall",[209,366,347],{"class":219},[209,368,369],{"class":215},"grid-row",[209,371,353],{"class":219},[209,373,125],{"class":215},[209,375,358],{"class":219},[209,377,379,382,385,387,389,391,394,396,398,400],{"class":211,"line":378},11,[209,380,381],{"class":215},".mosaic__tile--big",[209,383,384],{"class":219},"  { ",[209,386,350],{"class":215},[209,388,353],{"class":219},[209,390,125],{"class":215},[209,392,393],{"class":219},"; ",[209,395,369],{"class":215},[209,397,353],{"class":219},[209,399,125],{"class":215},[209,401,358],{"class":219},[209,403,405],{"class":211,"line":404},12,[209,406,338],{"emptyLinePlaceholder":337},[209,408,410,413,417],{"class":211,"line":409},13,[209,411,412],{"class":215},".mosaic__tile",[209,414,416],{"class":415},"sne4z"," img",[209,418,220],{"class":219},[209,420,422,425,427,430,433],{"class":211,"line":421},14,[209,423,424],{"class":215},"  inline-size",[209,426,229],{"class":219},[209,428,429],{"class":215},"100",[209,431,432],{"class":265},"%",[209,434,235],{"class":219},[209,436,438,441,443,445,447],{"class":211,"line":437},15,[209,439,440],{"class":215},"  block-size",[209,442,229],{"class":219},[209,444,429],{"class":215},[209,446,432],{"class":265},[209,448,235],{"class":219},[209,450,452,455,457,460],{"class":211,"line":451},16,[209,453,454],{"class":215},"  object-fit",[209,456,229],{"class":219},[209,458,459],{"class":215},"cover",[209,461,235],{"class":219},[209,463,465],{"class":211,"line":464},17,[209,466,331],{"class":219},[14,468,469,470,472,473,476,477,480],{},"Because the tiles are a decorative mosaic whose order does not matter, dense packing gives a better result with no downside. ",[18,471,252],{}," with ",[18,474,475],{},"minmax()"," makes the column count respond to the container width; as it changes, the holes move, and dense placement keeps filling them. Give each image meaningful ",[18,478,479],{},"alt"," text regardless; a mosaic is decorative in its arrangement, not necessarily in its content.",[34,482,484],{"id":483},"the-key-technique-dense-trades-source-order-for-density","The key technique: dense trades source order for density",[14,486,487],{},"Dense placement's whole effect is to move items out of source order. That is harmless when order carries no meaning and harmful when it does. Screen readers read items in DOM order, and keyboard focus moves in DOM order. In a dense grid, a user tabbing through linked tiles may see focus jump backwards and forwards across the grid as it follows the source order through visually reordered items.",[55,489,62,492,62,495,62,498,62,501,62,504,62,507,62,510,62,513,62,515,62,519,62,522,62,525,62,530,62,532,62,537,62,541],{"viewBox":490,"role":58,"ariaLabel":491,"xmlns":60,"style":61},"0 0 720 260","Focus order in a dense grid: tabbing follows source order 1, 2, 3, 4, 5, which on screen jumps from the second row back up to the first row and down again",[64,493,494],{},"Visual order and focus order diverge",[68,496,497],{},"The dense grid from before with numbered arrows showing keyboard focus order. Focus goes 1 to 2 along row one, then down to 3 on row two, then back up to 4 at the end of row one, then down to 5 on row two. The path zigzags because focus follows the source, not the layout.",[72,499,500],{"textAnchor":74,"x":75,"y":76,"style":77},"Tab order follows the source, not the grid",[90,502],{"x":503,"y":82,"width":92,"height":93,"rx":94,"fill":95,"opacity":96},"240",[90,505],{"x":506,"y":82,"width":92,"height":93,"rx":94,"fill":95,"opacity":96},"320",[90,508],{"x":509,"y":82,"width":92,"height":93,"rx":94,"fill":95,"opacity":96},"400",[90,511],{"x":503,"y":512,"width":99,"height":93,"rx":94,"fill":95,"opacity":112},"126",[90,514],{"x":509,"y":512,"width":92,"height":93,"rx":94,"fill":95,"opacity":96},[72,516,122],{"textAnchor":74,"x":517,"y":518,"style":121},"275","91",[72,520,125],{"textAnchor":74,"x":521,"y":518,"style":121},"355",[72,523,108],{"textAnchor":74,"x":524,"y":518,"style":121},"435",[72,526,529],{"textAnchor":74,"x":527,"y":528,"style":121},"315","161","3",[72,531,107],{"textAnchor":74,"x":524,"y":528,"style":121},[533,534],"path",{"d":535,"fill":103,"stroke":104,"strokeWidth":125,"strokeDashArray":536},"M290 100 L335 100 M365 105 L325 150 M335 150 L425 102 M440 105 L440 146",[108,529],[72,538,540],{"textAnchor":74,"x":75,"y":539,"style":169},"222","1 → 2 → 3 (down) → 4 (back up) → 5 (down again)",[72,542,544],{"textAnchor":74,"x":75,"y":543,"style":169},"244","WCAG 1.3.2 and 2.4.3 care about this when order is meaningful.",[14,546,547],{},"WCAG 1.3.2 (Meaningful Sequence) and 2.4.3 (Focus Order) apply when the sequence affects meaning or operation. A news grid sorted by date, search results, or a step-by-step list must not be densely packed. A tag cloud, a gallery of equivalent photos, or a set of decorative tiles can be. When in doubt, ask whether a user would be confused if the items were read in a different order than they appear; if so, avoid dense packing.",[34,549,551],{"id":550},"how-dense-interacts-with-explicitly-placed-items","How dense interacts with explicitly placed items",[14,553,554,555,558,559,562],{},"Grid places items in stages. Items with an explicit row ",[50,556,557],{},"and"," column position go first, and auto-placement then works around them. Items locked to a row but not a column come next, then fully auto-placed items. Dense packing only changes the last stage: it lets auto-placed items fill any cell the explicit items left free, anywhere in the grid. That makes a useful combination. Pin a hero tile to ",[18,560,561],{},"grid-column: 1 \u002F 3; grid-row: 1 \u002F 3",", and let dense auto-placement pack every other tile around it without holes.",[14,564,565,566,569,570,572],{},"The interaction also explains a surprise: adding ",[18,567,568],{},"order"," to items changes their position in the auto-placement sequence, and dense packing then moves them further. Visual order can end up very far from source order. Prefer changing spans or explicit positions over ",[18,571,568],{}," when a mosaic needs adjusting, so the source remains the best description of what the user will see.",[34,574,576],{"id":575},"checking-the-result","Checking the result",[14,578,579],{},"Grid inspectors in Chromium and Firefox DevTools overlay line numbers and area outlines on the grid. With dense packing, turn on the overlay and compare the numbers in each cell with the source order. Labelling tiles with their source index during development, as the demo does, makes the comparison instant and is worth removing only once the layout is settled. For interactive tiles, tab through the grid with the overlay on — any jump against the visual flow is exactly what a keyboard user will experience. If the jumps feel disorienting to you, they will for users too, and the layout should use one of the alternatives above.",[34,581,583],{"id":582},"alternatives-to-dense-packing","Alternatives to dense packing",[14,585,586],{},"When order matters but gaps are unwelcome, other approaches keep order and density together:",[588,589,590,598,609,619],"ul",{},[591,592,593,597],"li",{},[594,595,596],"strong",{},"Design the spans to fit."," If featured items always span two columns in a four-column grid, place them at predictable positions, such as every sixth item, so they land at the start of a row. Or set the column count so that spanning items tile evenly.",[591,599,600,603,604,608],{},[594,601,602],{},"Let the wide item shrink."," At narrow container sizes, remove the span with a container query so wide items become normal tiles instead of skipping rows. ",[23,605,607],{"href":606},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fhow-to-use-container-queries-in-production\u002F","How to Use Container Queries in Production"," shows the pattern.",[591,610,611,614,615,618],{},[594,612,613],{},"Place the featured item explicitly."," ",[18,616,617],{},"grid-column: 1 \u002F -1"," on a hero item puts it on its own full row, which never leaves holes.",[591,620,621,624],{},[594,622,623],{},"Accept the gaps."," A small, occasional gap in an ordered list is far less harmful than a reading order that jumps around.",[14,626,627,628,632],{},"For a true masonry look — items of varying height stacked without row alignment — see ",[23,629,631],{"href":630},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fmasonry-style-layouts-with-grid\u002F","Masonry-Style Layouts With Grid","; dense packing still aligns items to row tracks.",[34,634,636],{"id":635},"column-flow-and-dense","Column flow and dense",[14,638,639,642],{},[18,640,641],{},"grid-auto-flow: column dense"," applies the same logic to column-major placement: items fill each column top to bottom, and dense lets later items move up into earlier gaps. It is useful for vertical timelines of decorative elements and rare otherwise. The same accessibility caveat applies, with the added twist that column-major order already differs from the left-to-right reading order most users expect.",[34,644,646],{"id":645},"browser-support","Browser support",[14,648,649,651,652,655,656,659,660,662],{},[18,650,43],{},", including the ",[18,653,654],{},"dense"," keyword, is part of CSS Grid and is supported wherever grid is: Chrome 57+, Edge 16+, Firefox 52+ and Safari 10.1+. ",[18,657,658],{},"repeat()"," is supported in Chrome 57+, Edge 16+, Firefox 76+ and Safari 10.1+, and ",[18,661,475],{}," in Chrome 57+, Edge 16+, Firefox 52+ and Safari 10.1+. Size container queries, used in the alternatives, are supported in Chrome and Edge 105+, Firefox 110+ and Safari 16+.",[34,664,666],{"id":665},"faq","FAQ",[14,668,669,672],{},[594,670,671],{},"What does grid-auto-flow: dense do?","\nIt changes the auto-placement algorithm so that, for each item, the browser searches from the start of the grid for the first gap large enough, instead of only moving forward from the last placed item. Smaller items later in the source can fill holes left earlier.",[14,674,675,678],{},[594,676,677],{},"Why does my grid have empty cells when items span columns?","\nWith the default sparse placement, the cursor only moves forward. If a wide item does not fit in the remaining columns of a row, it moves to the next row and leaves the gap behind; later items are placed after it, so the gap stays empty.",[14,680,681,684],{},[594,682,683],{},"Is dense packing an accessibility problem?","\nIt can be. Dense placement moves items visually out of source order, while screen readers and keyboard focus follow the DOM. If the order carries meaning or items are interactive, the mismatch can confuse users and fail WCAG meaningful sequence and focus order.",[14,686,687,690],{},[594,688,689],{},"When is dense packing safe to use?","\nWhen the order of items does not matter and they are not focusable in a meaningful sequence, such as a decorative photo mosaic or a tag cloud. For ordered content like articles or search results, accept the gaps or size items to avoid them.",[34,692,694],{"id":693},"related","Related",[588,696,697,702,709,714],{},[591,698,699,701],{},[23,700,26],{"href":25}," — the parent guide.",[591,703,704,708],{},[23,705,707],{"href":706},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fauto-fit-minmax-responsive-grids\u002F","auto-fit and minmax() Responsive Grids"," — the column tracks used here.",[591,710,711,713],{},[23,712,631],{"href":630}," — when rows should not align.",[591,715,716,720],{},[23,717,719],{"href":718},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Foverlapping-elements-with-grid-stacking\u002F","Overlapping Elements With Grid Stacking"," — explicit placement in the same grid.",[722,723,724],"style",{},"html pre.shiki code .s-5SL, html code.shiki .s-5SL{--shiki-default:#023B95;--shiki-dark:#91CBFF}html pre.shiki code .suds8, html code.shiki .suds8{--shiki-default:#0E1116;--shiki-dark:#F0F3F6}html pre.shiki code .sHUrx, html code.shiki .sHUrx{--shiki-default:#A0111F;--shiki-dark:#FF9492}html pre.shiki code .sLBg1, html code.shiki .sLBg1{--shiki-default:#66707B;--shiki-dark:#BDC4CC}html pre.shiki code .sne4z, html code.shiki .sne4z{--shiki-default:#024C1A;--shiki-dark:#72F088}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":205,"searchDepth":223,"depth":223,"links":726},[727,728,729,730,731,732,733,734,735,736,737],{"id":36,"depth":223,"text":37},{"id":173,"depth":223,"text":174},{"id":190,"depth":223,"text":191},{"id":483,"depth":223,"text":484},{"id":550,"depth":223,"text":551},{"id":575,"depth":223,"text":576},{"id":582,"depth":223,"text":583},{"id":635,"depth":223,"text":636},{"id":645,"depth":223,"text":646},{"id":665,"depth":223,"text":666},{"id":693,"depth":223,"text":694},"Fill the holes that spanning items leave in auto-placed grids with grid-auto-flow: dense, when it helps, and why it can break reading and focus order.","md",{"pageTitle":5,"datePublished":741,"dateModified":741,"faq":742},"2026-09-18",[743,745,747,749],{"q":671,"a":744},"It changes the auto-placement algorithm so that, for each item, the browser searches from the start of the grid for the first gap large enough, instead of only moving forward from the last placed item. Smaller items later in the source can fill holes left earlier.",{"q":677,"a":746},"With the default sparse placement, the cursor only moves forward. If a wide item does not fit in the remaining columns of a row, it moves to the next row and leaves the gap behind; later items are placed after it, so the gap stays empty.",{"q":683,"a":748},"It can be. Dense placement moves items visually out of source order, while screen readers and keyboard focus follow the DOM. If the order carries meaning or items are interactive, the mismatch can confuse users and fail WCAG meaningful sequence and focus order.",{"q":689,"a":750},"When the order of items does not matter and they are not focusable in a meaningful sequence, such as a decorative photo mosaic or a tag cloud. For ordered content like articles or search results, accept the gaps or size items to avoid them.","\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fgrid-auto-flow-dense-packing",{"title":5,"description":738},"mastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fgrid-auto-flow-dense-packing\u002Findex","5X7Leb4BQiukjzKJB4O0n13zSq5_-U78MwHhgOOg-qc",[756,759,762,765,768,771,774,777,780,783,786,789,792,795,798,801,804,807,810,813,816,819,822,825,828,831,834,837,840,843,846,849,852,855,858,861,864,867,870,873,876,879,882,885,888,891,894,897,900,903,906,909,912,915,918,921,924,927,930,933,936,939,942,945,948,951,954,957,960,963,966,969,972,975,978,981,984,987,990,993,996,999,1002,1005,1008,1011,1014,1017,1020,1023,1026,1029,1032,1035,1038,1041,1044,1047,1050,1053,1056,1059,1062,1065,1068,1071,1074,1077,1080,1083,1086,1089,1092,1095,1098,1101,1104,1107,1110,1111,1114,1117,1120,1123,1126,1129,1132,1135,1138,1141,1144,1147,1150,1153,1156,1159,1162,1165,1168,1171,1174,1176,1179,1182,1185,1188,1191,1194,1197,1200,1203,1206,1209,1212,1215,1218,1221,1224,1227,1230,1233,1236,1239,1242,1245,1248,1251,1254,1257,1260,1263,1266,1269,1272,1275,1278,1281,1284,1287,1290,1293,1296,1299,1302,1305,1308,1311],{"path":757,"title":758},"\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":760,"title":761},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fflashing-content-and-seizure-thresholds","Flashing Content and Seizure Thresholds",{"path":763,"title":764},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fforced-colors-mode-and-animations","Forced Colors Mode and Animations",{"path":766,"title":767},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations","Accessibility in CSS Animations: Patterns, Specs & Best Practices",{"path":769,"title":770},"\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":772,"title":773},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fprefers-reduced-motion-recipes","prefers-reduced-motion Recipes: A Reduction for Every Common Effect",{"path":775,"title":776},"\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":778,"title":779},"\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":781,"title":782},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fvestibular-safe-animation-patterns","Vestibular-Safe Animation Patterns: Why Some Motion Makes People Sick",{"path":784,"title":785},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fwcag-motion-success-criteria","WCAG Motion Success Criteria: What Each One Actually Requires",{"path":787,"title":788},"\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":790,"title":791},"\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":793,"title":794},"\u002Fcss-only-micro-interactions-animations\u002Fclip-path-and-mask-animations","Clip-Path & Mask Animations: Animating Visibility Instead of Position",{"path":796,"title":797},"\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":799,"title":800},"\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":802,"title":803},"\u002Fcss-only-micro-interactions-animations\u002Fcolor-and-theme-transitions\u002Fanimating-gradients","Animating CSS Gradients: Smooth Colour Motion Without Jumps",{"path":805,"title":806},"\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":808,"title":809},"\u002Fcss-only-micro-interactions-animations\u002Fcolor-and-theme-transitions","Color & Theme Transitions: Colour as Part of the Motion System",{"path":811,"title":812},"\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":814,"title":815},"\u002Fcss-only-micro-interactions-animations\u002Fcolor-and-theme-transitions\u002Fsmooth-theme-switching-transitions","Smooth Theme Switching: Crossfades, Circular Reveals and No Flash",{"path":817,"title":818},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion\u002Fcontainer-query-hover-affordances","Container Query Hover Affordances: When Narrow Means Persistent, Not Hidden",{"path":820,"title":821},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion","Container-Aware Motion: Animation Sized by the Space a Component Actually Has",{"path":823,"title":824},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion\u002Flayout-change-animations-at-container-breakpoints","Animating Changes at Container Breakpoints",{"path":826,"title":827},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion\u002Fmotion-driven-by-container-style-queries","Motion Driven by Container Style Queries",{"path":829,"title":830},"\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":832,"title":833},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion\u002Fsuppressing-motion-in-small-containers","Suppressing Motion in Small Containers: Deliberately Animating Nothing",{"path":835,"title":836},"\u002Fcss-only-micro-interactions-animations\u002Fcss-animation-vs-web-animations-api\u002Fcontrolling-css-animations-from-javascript","Controlling CSS Animations From JavaScript",{"path":838,"title":839},"\u002Fcss-only-micro-interactions-animations\u002Fcss-animation-vs-web-animations-api","CSS Animation vs the Web Animations API: A Decision Guide",{"path":841,"title":842},"\u002Fcss-only-micro-interactions-animations\u002Fcss-animation-vs-web-animations-api\u002Fwaapi-vs-css-for-interruptible-ui","Interruptible UI: CSS Transitions vs WAAPI",{"path":844,"title":845},"\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":847,"title":848},"\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":850,"title":851},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture\u002Fcustom-property-fallbacks-and-invalid-values","Custom Property Fallbacks and Invalid Values",{"path":853,"title":854},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture\u002Ffluid-spacing-tokens-driving-transition-durations","Fluid Spacing Tokens That Drive Transition Durations",{"path":856,"title":857},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture","CSS Custom Properties Architecture: Scalable Design Systems & Dynamic UI",{"path":859,"title":860},"\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":862,"title":863},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture\u002Fscoping-custom-properties-to-components","Scoping Custom Properties to Components",{"path":865,"title":866},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Fcss-transition-timing-functions","CSS Transition Timing Functions: ease, cubic-bezier(), steps() and linear()",{"path":868,"title":869},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals","CSS Transition Fundamentals: Architecture, Performance & Patterns",{"path":871,"title":872},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Finterrupted-and-reversing-transitions","Interrupted and Reversing Transitions: What Happens Mid-Flight",{"path":874,"title":875},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Fstarting-style-entry-animations","@starting-style: Animating an Element's Very First Style Change",{"path":877,"title":878},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Ftransition-delay-choreography","Choreographing Motion With transition-delay",{"path":880,"title":881},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Ftransition-shorthand-and-multiple-properties","The transition Shorthand and Multiple Properties",{"path":883,"title":884},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Ftransitioning-display-with-allow-discrete","Transitioning display with transition-behavior: allow-discrete and @starting-style",{"path":886,"title":887},"\u002Fcss-only-micro-interactions-animations\u002Fdialog-and-popover-animations\u002Fanimating-dialog-open-and-close","Animating \u003Cdialog> Open and Close: Both Directions, No Library",{"path":889,"title":890},"\u002Fcss-only-micro-interactions-animations\u002Fdialog-and-popover-animations\u002Fbackdrop-animations","Animating ::backdrop: Fades and Blurs Behind Dialogs and Popovers",{"path":892,"title":893},"\u002Fcss-only-micro-interactions-animations\u002Fdialog-and-popover-animations","Dialog & Popover Animations: Motion for the Top Layer",{"path":895,"title":896},"\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":898,"title":899},"\u002Fcss-only-micro-interactions-animations\u002Fdialog-and-popover-animations\u002Fpopover-entry-and-exit-transitions","Popover Menus That Animate From Their Anchor",{"path":901,"title":902},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design\u002Fchoosing-animation-durations","Choosing Animation Durations: How Long Motion Should Last",{"path":904,"title":905},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design\u002Fcubic-bezier-overshoot-and-anticipation","Overshoot and Anticipation With cubic-bezier(): Motion With Character",{"path":907,"title":908},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design\u002Fentry-vs-exit-easing","Entry vs Exit Easing: Different Curves for Arriving and Leaving",{"path":910,"title":911},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design","Easing & Motion Design: Making CSS Motion Feel Intentional",{"path":913,"title":914},"\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":916,"title":917},"\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":919,"title":920},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design\u002Faccessible-css-only-tooltips","Accessible CSS-Only Tooltips and Hover Cards With  and ",{"path":922,"title":923},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design\u002Fbutton-press-and-active-states","Button Press and  States",{"path":925,"title":926},"\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":928,"title":929},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design\u002Ffocus-within-form-patterns"," Form Patterns: Styling a Group From the Field Inside It",{"path":931,"title":932},"\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":934,"title":935},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design","Hover & Focus State Design: Spec-Compliant Patterns for Modern UIs",{"path":937,"title":938},"\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":940,"title":941},"\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":943,"title":944},"\u002Fcss-only-micro-interactions-animations","CSS-Only Micro-Interactions & Animations: Architecture, Performance & Implementation",{"path":946,"title":947},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fanimation-composition-and-stacking","Stacking Animations With animation-composition",{"path":949,"title":950},"\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":952,"title":953},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fcontainer-query-triggered-keyframe-animations","Container-Query-Triggered Keyframe Animations: Animate Differently per Available Space",{"path":955,"title":956},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fcss-only-accordions-and-disclosure","CSS-Only Accordions and Disclosure Widgets with details and summary",{"path":958,"title":959},"\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":961,"title":962},"\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":964,"title":965},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns","Keyframe Animation Patterns: Spec-Compliant Architectures for Modern UIs",{"path":967,"title":968},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fmulti-step-keyframes-and-per-keyframe-easing","Multi-Step Keyframes and Per-Keyframe Easing",{"path":970,"title":971},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fstaggered-list-animations-with-custom-properties","Staggered List Animations Using --i Index Custom Properties",{"path":973,"title":974},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Fanimating-box-shadow-and-filters-cheaply","Animating box-shadow and Filters Cheaply",{"path":976,"title":977},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Fcontain-property-for-animation-performance","The contain Property for Animation Performance",{"path":979,"title":980},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Fcss-triggers-layout-paint-composite","Layout, Paint and Composite: What Triggers What",{"path":982,"title":983},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration","Performance & GPU Acceleration in CSS: A Developer’s Blueprint",{"path":985,"title":986},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Foptimizing-css-animations-for-60fps","Optimizing CSS Animations for 60fps: Budgeting the Frame",{"path":988,"title":989},"\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":991,"title":992},"\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":994,"title":995},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations","Scroll-Driven Animations: Binding Motion to Scroll Position in Pure CSS",{"path":997,"title":998},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fscroll-driven-animation-fallbacks","Shipping Scroll-Driven Animations Without Breaking Anything",{"path":1000,"title":1001},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fscroll-driven-parallax-effects","Scroll-Driven Parallax Effects in CSS",{"path":1003,"title":1004},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fscroll-progress-bar-without-javascript","A Reading Progress Bar Driven by scroll(root)",{"path":1006,"title":1007},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fscroll-triggered-reveal-animations","Reveal-on-Scroll with view() and animation-range",{"path":1009,"title":1010},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Ftimeline-scope-for-cross-element-animations","timeline-scope for Cross-Element Animations",{"path":1012,"title":1013},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fview-timeline-and-animation-range","View Timelines and animation-range",{"path":1015,"title":1016},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fcross-document-view-transitions","Cross-Document View Transitions",{"path":1018,"title":1019},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers","View Transitions for CSS Developers: the Pseudo-Element Tree, Snapshots, and Named Elements",{"path":1021,"title":1022},"\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":1024,"title":1025},"\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":1027,"title":1028},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fview-transition-types-and-classes","View Transition Types and Classes",{"path":1030,"title":1031},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fview-transitions-for-list-reordering","View Transitions for List Reordering",{"path":1033,"title":1034},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fview-transitions-with-reduced-motion","Honouring prefers-reduced-motion in View Transitions",{"path":1036,"title":1037},"\u002F","Modern CSS Layouts & Micro-Interactions",{"path":1039,"title":1040},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fanchor-positioned-tooltips","Anchor-Positioned Tooltips: Tethering, Flipping, and Getting the Semantics Right",{"path":1042,"title":1043},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fanchor-positioning-fallbacks","Anchor Positioning Fallbacks: A Graceful Floor for Older Browser Versions",{"path":1045,"title":1046},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fanchor-size-for-matching-widths","anchor-size(): Overlays That Match Their Trigger's Size",{"path":1048,"title":1049},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays","CSS Anchor Positioning and Overlays: Tethering Elements Without JavaScript",{"path":1051,"title":1052},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fpopover-attribute-and-css-styling","The popover Attribute: Top-Layer Overlays With No JavaScript",{"path":1054,"title":1055},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fpopover-light-dismiss-and-stacking","Popover Light Dismiss, Nesting and Stacking",{"path":1057,"title":1058},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fposition-area-grid-explained","position-area: The Anchor Placement Grid",{"path":1060,"title":1061},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Fcontainer-query-polyfill-tradeoffs","Container Query Polyfills: What They Cost and When to Skip Them",{"path":1063,"title":1064},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Ffeature-detection-with-supports","Feature Detection with @supports: Syntax, Semantics, and the Traps",{"path":1066,"title":1067},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Fhandling-container-query-fallbacks-for-older-browsers","Handling Container Query Fallbacks for Older Browsers",{"path":1069,"title":1070},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks","Container Query Fallbacks: Spec-Compliant CSS Strategies for Legacy Browsers",{"path":1072,"title":1073},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Fintrinsic-layout-fallbacks-without-queries","Intrinsic Layout Fallbacks: Baselines That Adapt Without Any Query",{"path":1075,"title":1076},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Ftesting-fallbacks-without-old-browsers","Testing CSS Fallbacks Without an Old Browser",{"path":1078,"title":1079},"\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":1081,"title":1082},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fcontainer-query-range-and-logic-operators","Container Query Range Syntax and Logic Operators",{"path":1084,"title":1085},"\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":1087,"title":1088},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fcontainer-type-size-vs-inline-size","Choosing container-type: inline-size, size, or normal",{"path":1090,"title":1091},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fcontainer-vs-media-queries-comparison","Container vs Media Queries: Choosing the Right Reference Box",{"path":1093,"title":1094},"\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":1096,"title":1097},"\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":1099,"title":1100},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics","Container Query Syntax Basics",{"path":1102,"title":1103},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fnesting-and-naming-container-queries","Nesting and Naming Container Queries: Targeting the Right Ancestor",{"path":1105,"title":1106},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fauto-fit-minmax-responsive-grids","Responsive Grids with repeat(auto-fit, minmax())",{"path":1108,"title":1109},"\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":751,"title":5},{"path":1112,"title":1113},"\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":1115,"title":1116},"\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":1118,"title":1119},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts","CSS Grid and Subgrid Layouts for Responsive Interfaces",{"path":1121,"title":1122},"\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":1124,"title":1125},"\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":1127,"title":1128},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fsubgrid-vs-nested-grid","Subgrid vs an Independently Nested Grid",{"path":1130,"title":1131},"\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":1133,"title":1134},"\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":1136,"title":1137},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fflex-grow-and-flex-shrink-explained","flex-grow and flex-shrink Explained",{"path":1139,"title":1140},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fflex-wrap-intrinsic-responsive-rows","Breakpoint-Free Responsive Rows With flex-wrap and flex-basis",{"path":1142,"title":1143},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fflexbox-gap-and-spacing","Flexbox gap vs Margins: Spacing Items Without Edge Hacks",{"path":1145,"title":1146},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns","Flexbox Layout Patterns: One-Dimensional Layout for Real Components",{"path":1148,"title":1149},"\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":1151,"title":1152},"\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":1154,"title":1155},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp\u002Fdebugging-clamp-values","Debugging clamp(): Values That Are Ignored, Stuck or Never Fluid",{"path":1157,"title":1158},"\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":1160,"title":1161},"\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":1163,"title":1164},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp\u002Ffluid-type-accessibility-and-zoom","Fluid Type, Accessibility and Zoom: The vw-Only Trap",{"path":1166,"title":1167},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp\u002Ffluid-typography-without-javascript","Fluid Typography Without JavaScript: A Precision CSS Reference",{"path":1169,"title":1170},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp","Fluid Typography with clamp(): A Practical Guide for Modern CSS",{"path":1172,"title":1173},"\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":1175,"title":31},"\u002Fmastering-container-queries-responsive-layouts",{"path":1177,"title":1178},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Faspect-ratio-for-responsive-media","Using aspect-ratio for Responsive Media and Preventing Layout Shift",{"path":1180,"title":1181},"\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":1183,"title":1184},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques","Intrinsic Sizing Techniques: Modern CSS Layouts for Responsive UI",{"path":1186,"title":1187},"\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":1189,"title":1190},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Fmin-max-fit-content-explained","min-content, max-content, and fit-content() Explained",{"path":1192,"title":1193},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Fobject-fit-and-object-position","object-fit and object-position: Images That Fit Any Box",{"path":1195,"title":1196},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Fpreventing-flex-and-grid-overflow","The min-width: auto Trap in Flex and Grid Layouts",{"path":1198,"title":1199},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies\u002Fcascade-layers-for-reset-and-tokens","Cascade Layers for Reset and Design Tokens",{"path":1201,"title":1202},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies\u002Fcascade-layers-vs-specificity-hacks","Cascade Layers vs Specificity Hacks: Ordering Instead of Escalating",{"path":1204,"title":1205},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies\u002Fcss-scope-for-component-styles","@scope for Component Styles: Short Selectors That Cannot Leak",{"path":1207,"title":1208},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies","Modern CSS Reset Strategies: A Spec-Compliant Foundation",{"path":1210,"title":1211},"\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":1213,"title":1214},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies\u002Fwriting-a-minimal-modern-reset","Writing a Minimal Modern CSS Reset: Every Line Justified",{"path":1216,"title":1217},"\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":1219,"title":1220},"\u002Fmastering-container-queries-responsive-layouts\u002Fparent-aware-layouts-with-has\u002Fempty-and-loading-states-with-has","Empty and Loading States With ()",{"path":1222,"title":1223},"\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":1225,"title":1226},"\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":1228,"title":1229},"\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":1231,"title":1232},"\u002Fmastering-container-queries-responsive-layouts\u002Fparent-aware-layouts-with-has","Parent-Aware Layouts With :has(): Letting Containers React to Their Contents",{"path":1234,"title":1235},"\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":1237,"title":1238},"\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":1240,"title":1241},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fcontainer-query-data-tables","Container Query Data Tables: Reflowing Tables to Cards",{"path":1243,"title":1244},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fcontainer-query-sidebar-layouts","Container Query Sidebar Layouts That Travel Between Contexts",{"path":1246,"title":1247},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns","Responsive Component Patterns: Architecture & Implementation",{"path":1249,"title":1250},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fresponsive-forms-with-container-queries","Responsive Forms with Container Queries: Reflow Without Losing the Wiring",{"path":1252,"title":1253},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fresponsive-hero-sections-with-container-queries","Responsive Hero Sections With Container Queries",{"path":1255,"title":1256},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fresponsive-navigation-without-media-queries","Responsive Navigation Without Media Queries Using Container Queries",{"path":1258,"title":1259},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fresponsive-pricing-tables","Responsive Pricing Tables: Aligned Features, a Clear Recommendation, Any Width",{"path":1261,"title":1262},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Ftabs-that-become-accordions","Tabs That Become an Accordion: One Component, Two Layouts",{"path":1264,"title":1265},"\u002Fmastering-container-queries-responsive-layouts\u002Fscroll-snap-and-overflow-layouts\u002Fcss-only-carousel-with-scroll-snap","A CSS-Only Carousel With Scroll Snap",{"path":1267,"title":1268},"\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":1270,"title":1271},"\u002Fmastering-container-queries-responsive-layouts\u002Fscroll-snap-and-overflow-layouts","Scroll Snap & Overflow Layouts: Designing Components That Scroll on Purpose",{"path":1273,"title":1274},"\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":1276,"title":1277},"\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":1279,"title":1280},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state\u002Fcombining-size-and-style-queries","Combining Size and Style Container Queries",{"path":1282,"title":1283},"\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":1285,"title":1286},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state","Style Queries and Container State: Token-Driven Component Variants",{"path":1288,"title":1289},"\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":1291,"title":1292},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state\u002Fstyle-query-component-variants","Component Variants With Style Queries: One Token, Many Looks",{"path":1294,"title":1295},"\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":1297,"title":1298},"\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":1300,"title":1301},"\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":1303,"title":1304},"\u002Fmastering-container-queries-responsive-layouts\u002Fviewport-units-and-mobile-layout","Viewport Units & Mobile Layout: Designing for the Screen You Actually Get",{"path":1306,"title":1307},"\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":1309,"title":1310},"\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":1312,"title":1313},"\u002Fmastering-container-queries-responsive-layouts\u002Fviewport-units-and-mobile-layout\u002Fvirtual-keyboard-and-interactive-widget","Layouts That Survive the Virtual Keyboard",{"title":1315,"caption":1316,"height":1317,"resizable":337,"html":1318,"css":1319},"Sparse and dense auto-placement","Tick \"dense\" to let later tiles fill the holes left by spanning tiles. The numbers show source order — notice how dense placement moves them out of sequence. Resize to change the column count.",380,"\n\u003Cdiv class=\"demo\">\n  \u003Clabel class=\"toggle\">\u003Cinput type=\"checkbox\" id=\"dense\"> dense\u003C\u002Flabel>\n  \u003Cdiv class=\"mosaic\">\n    \u003Cdiv class=\"t\">1\u003C\u002Fdiv>\u003Cdiv class=\"t\">2\u003C\u002Fdiv>\u003Cdiv class=\"t t--wide\">3\u003C\u002Fdiv>\u003Cdiv class=\"t\">4\u003C\u002Fdiv>\n    \u003Cdiv class=\"t t--big\">5\u003C\u002Fdiv>\u003Cdiv class=\"t\">6\u003C\u002Fdiv>\u003Cdiv class=\"t t--wide\">7\u003C\u002Fdiv>\u003Cdiv class=\"t t--tall\">8\u003C\u002Fdiv>\n    \u003Cdiv class=\"t\">9\u003C\u002Fdiv>\u003Cdiv class=\"t t--wide\">10\u003C\u002Fdiv>\u003Cdiv class=\"t\">11\u003C\u002Fdiv>\u003Cdiv class=\"t\">12\u003C\u002Fdiv>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>","\n.demo { display: grid; gap: 0.75rem; padding: 1rem; }\n.toggle { display: flex; gap: 0.5rem; align-items: center; font-weight: 600; }\n.mosaic { display: grid; grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr)); grid-auto-rows: 3.5rem; gap: 0.5rem; grid-auto-flow: row; }\n.demo:has(#dense:checked) .mosaic { grid-auto-flow: row dense; }\n.t { display: grid; place-items: center; border-radius: 6px; background: color-mix(in srgb, var(--demo-accent) 30%, var(--demo-surface)); font-weight: 700; }\n.t--wide { grid-column: span 2; background: color-mix(in srgb, var(--demo-accent) 55%, var(--demo-surface)); }\n.t--tall { grid-row: span 2; background: color-mix(in srgb, var(--demo-accent) 55%, var(--demo-surface)); }\n.t--big { grid-column: span 2; grid-row: span 2; background: color-mix(in srgb, var(--demo-accent) 75%, var(--demo-surface)); color: #fff; }",1789717744838]