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