[{"data":1,"prerenderedAt":1375},["ShallowReactive",2],{"page-\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fflex-grow-and-flex-shrink-explained\u002F":3,"content-all-pages":810,"live-demo:flex-grow-shrink":1369},{"id":4,"title":5,"body":6,"description":793,"extension":794,"meta":795,"navigation":370,"path":806,"seo":807,"stem":808,"__hash__":809},"content\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fflex-grow-and-flex-shrink-explained\u002Findex.md","flex-grow and flex-shrink Explained",{"type":7,"value":8,"toc":779},"minimark",[9,13,36,41,66,70,95,191,202,206,224,287,294,298,301,305,506,509,513,527,554,558,569,573,576,580,586,635,642,646,665,669,688,692,707,721,736,747,751,775],[10,11,5],"h1",{"id":12},"flex-grow-and-flex-shrink-explained",[14,15,16,20,21,24,25,30,31,35],"p",{},[17,18,19],"code",{},"flex: 1"," is probably the most copied declaration in CSS, and most people who use it could not say exactly what it does. That is fine until a layout misbehaves: one column refuses to shrink, two items with the same ",[17,22,23],{},"flex-grow"," end up different widths, a sidebar squashes instead of the main content. All of these follow from two short algorithms — how flexbox distributes free space when there is room, and how it takes space away when there is not. Once those are clear, choosing flex values becomes deliberate. This page walks through both algorithms, the minimum-size rule that overrides them, and the handful of flex values worth memorising. It belongs to ",[26,27,29],"a",{"href":28},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002F","Flexbox Layout Patterns"," in the ",[26,32,34],{"href":33},"\u002Fmastering-container-queries-responsive-layouts\u002F","Mastering Container Queries & Responsive Layouts"," guide.",[37,38,40],"h2",{"id":39},"step-one-place-the-bases","Step one: place the bases",[14,42,43,44,48,49,52,53,56,57,60,61,65],{},"Every flex item starts at its ",[45,46,47],"em",{},"flex basis",": the ",[17,50,51],{},"flex-basis"," value if set, otherwise its ",[17,54,55],{},"width"," (or ",[17,58,59],{},"height"," in a column), otherwise its content size. The browser adds up the bases plus gaps and compares the total with the container's size. If there is space left over, the items grow. If the total overflows, the items shrink. Only one of the two happens in any layout pass. ",[26,62,64],{"href":63},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fflex-basis-vs-width\u002F","flex-basis vs width"," covers how the basis is chosen.",[37,67,69],{"id":68},"growing-free-space-shared-by-ratio","Growing: free space shared by ratio",[14,71,72,73,75,76,79,80,83,84,87,88,91,92,94],{},"When there is free space, it is divided among the items in proportion to their ",[17,74,23],{}," values. An item with ",[17,77,78],{},"flex-grow: 0"," receives none. If two items have ",[17,81,82],{},"flex-grow: 1"," and one has ",[17,85,86],{},"flex-grow: 2",", the free space is split into four shares: one each for the first two, two for the third. The shares are ",[45,89,90],{},"added to each item's basis"," — which is why ",[17,93,86],{}," does not mean \"twice as wide\", only \"twice as much of the leftover\".",[96,97,103,104,103,108,103,112,103,120,103,130,103,138,103,142,103,145,103,150,103,153,103,156,103,161,103,164,103,168,103,171,103,175,103,180,103,183,103,187],"svg",{"viewBox":98,"role":99,"ariaLabel":100,"xmlns":101,"style":102},"0 0 720 300","img","A 600 pixel container with three items of basis 100 pixels: 300 pixels of free space are split 1 to 1 to 2, giving final widths of 175, 175 and 250 pixels","http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg","width:100%;height:auto;max-width:720px;margin:2rem 0","\n  ",[105,106,107],"title",{},"Growing adds shares of the leftover",[109,110,111],"desc",{},"Top row: three 100 pixel bases in a 600 pixel container, leaving 300 pixels of free space. Bottom row: the free space is divided into four 75 pixel shares. Items with flex-grow 1 gain one share each and become 175 pixels; the item with flex-grow 2 gains two shares and becomes 250 pixels, not twice the width of the others.",[113,114,119],"text",{"textAnchor":115,"x":116,"y":117,"style":118},"middle","360","26","text-anchor:middle;fill:currentColor;font:700 17px sans-serif","flex-grow: 1, 1, 2 in a 600px container",[121,122],"rect",{"x":123,"y":123,"width":124,"height":123,"rx":125,"fill":126,"stroke":127,"strokeWidth":128,"opacity":129},"60","600","6","none","currentColor","1.5","0.6",[121,131],{"x":123,"y":132,"width":133,"height":134,"rx":135,"fill":136,"opacity":137},"70","100","40","4","#7aa2ff","0.5",[121,139],{"x":140,"y":132,"width":133,"height":134,"rx":135,"fill":136,"opacity":141},"160","0.35",[121,143],{"x":144,"y":132,"width":133,"height":134,"rx":135,"fill":136,"opacity":137},"260",[113,146,133],{"textAnchor":115,"x":147,"y":148,"style":149},"110","95","text-anchor:middle;fill:currentColor;font:12px ui-monospace,monospace",[113,151,133],{"textAnchor":115,"x":152,"y":148,"style":149},"210",[113,154,133],{"textAnchor":115,"x":155,"y":148,"style":149},"310",[113,157,160],{"textAnchor":115,"x":158,"y":148,"style":159},"510","text-anchor:middle;fill:currentColor;font:12px sans-serif","300px free",[121,162],{"x":123,"y":163,"width":124,"height":123,"rx":125,"fill":126,"stroke":127,"strokeWidth":128,"opacity":129},"170",[121,165],{"x":123,"y":166,"width":167,"height":134,"rx":135,"fill":136,"opacity":137},"180","175",[121,169],{"x":170,"y":166,"width":167,"height":134,"rx":135,"fill":136,"opacity":141},"235",[121,172],{"x":173,"y":166,"width":174,"height":134,"rx":135,"fill":136,"opacity":137},"410","250",[113,176,179],{"textAnchor":115,"x":177,"y":178,"style":149},"147","205","100 + 75 = 175",[113,181,179],{"textAnchor":115,"x":182,"y":178,"style":149},"322",[113,184,186],{"textAnchor":115,"x":185,"y":178,"style":149},"535","100 + 150 = 250",[113,188,190],{"textAnchor":115,"x":116,"y":189,"style":159},"266","Four shares of 75px: grow values add shares, they do not multiply widths.",[14,192,193,194,197,198,201],{},"To make items proportional to their grow values, give them a zero basis: ",[17,195,196],{},"flex: 2 1 0"," and ",[17,199,200],{},"flex: 1 1 0",". With nothing to start from, the whole container is free space, and the final widths are exactly 2:1.",[37,203,205],{"id":204},"shrinking-overflow-taken-by-weighted-ratio","Shrinking: overflow taken by weighted ratio",[14,207,208,209,212,213,215,216,219,220,223],{},"When the bases overflow, the overflow is removed from the items — but not simply in proportion to ",[17,210,211],{},"flex-shrink",". Each item's share of the reduction is proportional to its ",[17,214,211],{}," ",[45,217,218],{},"multiplied by its flex basis",". A 400-pixel item and a 100-pixel item, both with ",[17,221,222],{},"flex-shrink: 1",", lose pixels in a 4:1 ratio. The rule makes sense: large items can afford to give up more, and small items do not collapse to nothing while large ones barely change.",[96,225,103,228,103,231,103,234,103,237,103,242,103,246,103,253,103,257,103,260,103,265,103,268,103,272,103,276,103,280,103,283],{"viewBox":226,"role":99,"ariaLabel":227,"xmlns":101,"style":102},"0 0 720 280","Bases of 400 and 100 pixels in a 400 pixel container overflow by 100 pixels; with equal flex-shrink the reduction is weighted by basis, 80 and 20 pixels, giving 320 and 80",[105,229,230],{},"Shrinking is weighted by basis",[109,232,233],{},"Top: a 400 pixel item and a 100 pixel item in a 400 pixel container, overflowing by 100 pixels. Bottom: both have flex-shrink 1, but the reduction is split in proportion to basis, 4 to 1. The large item loses 80 pixels and becomes 320; the small item loses 20 and becomes 80.",[113,235,236],{"textAnchor":115,"x":116,"y":117,"style":118},"Equal flex-shrink, unequal shrinking",[121,238],{"x":140,"y":239,"width":240,"height":123,"rx":125,"fill":126,"stroke":127,"strokeWidth":241},"56","400","2",[121,243],{"x":140,"y":244,"width":240,"height":134,"rx":135,"fill":136,"opacity":245},"66","0.45",[247,248],"path",{"d":249,"fill":127,"opacity":250,"stroke":127,"strokeDashArray":251},"M560 66 H660 V106 H560 Z","0.2",[135,252],"3",[113,254,256],{"textAnchor":115,"x":116,"y":255,"style":149},"91","basis 400",[113,258,133],{"textAnchor":115,"x":259,"y":255,"style":149},"610",[113,261,264],{"textAnchor":115,"x":259,"y":262,"style":263},"136","text-anchor:middle;fill:currentColor;font:11px sans-serif","overflows by 100",[121,266],{"x":140,"y":267,"width":240,"height":123,"rx":125,"fill":126,"stroke":127,"strokeWidth":241},"166",[121,269],{"x":140,"y":270,"width":271,"height":134,"rx":135,"fill":136,"opacity":245},"176","320",[121,273],{"x":274,"y":270,"width":275,"height":134,"rx":135,"fill":127,"opacity":250},"480","80",[113,277,279],{"textAnchor":115,"x":271,"y":278,"style":149},"201","400 − 80 = 320",[113,281,275],{"textAnchor":115,"x":282,"y":278,"style":149},"520",[113,284,286],{"textAnchor":115,"x":116,"y":285,"style":159},"258","Reduction split 4:1 by basis × flex-shrink.",[14,288,289,290,293],{},"Setting ",[17,291,292],{},"flex-shrink: 0"," exempts an item entirely; it stays at its basis and the others absorb all of the overflow. That is the standard way to keep a fixed-width sidebar or an icon from being squeezed.",[37,295,297],{"id":296},"the-complete-implementation","The complete implementation",[14,299,300],{},"The demo shows the common layout of a fixed sidebar, a flexible main area and a secondary panel. Resize the frame to see how each item responds.",[302,303],"live-demo",{"name":304},"flex-grow-shrink",[306,307,312],"pre",{"className":308,"code":309,"language":310,"meta":311,"style":311},"language-css shiki shiki-themes github-light-high-contrast github-dark-high-contrast",".layout {\n  display: flex;\n  gap: 1rem;\n}\n\n.layout__nav {\n  flex: 0 0 12rem;        \u002F* never grows, never shrinks: fixed 12rem *\u002F\n}\n\n.layout__main {\n  flex: 1 1 20rem;        \u002F* starts at 20rem, takes all spare space, shrinks first *\u002F\n  min-inline-size: 0;     \u002F* allow shrinking below long content *\u002F\n}\n\n.layout__aside {\n  flex: 0 1 16rem;        \u002F* 16rem when it fits, shrinks when it must, never grows *\u002F\n}\n","css","",[17,313,314,327,342,359,365,372,380,406,411,416,424,446,462,467,472,480,501],{"__ignoreMap":311},[315,316,319,323],"span",{"class":317,"line":318},"line",1,[315,320,322],{"class":321},"s-5SL",".layout",[315,324,326],{"class":325},"suds8"," {\n",[315,328,330,333,336,339],{"class":317,"line":329},2,[315,331,332],{"class":321},"  display",[315,334,335],{"class":325},": ",[315,337,338],{"class":321},"flex",[315,340,341],{"class":325},";\n",[315,343,345,348,350,353,357],{"class":317,"line":344},3,[315,346,347],{"class":321},"  gap",[315,349,335],{"class":325},[315,351,352],{"class":321},"1",[315,354,356],{"class":355},"sHUrx","rem",[315,358,341],{"class":325},[315,360,362],{"class":317,"line":361},4,[315,363,364],{"class":325},"}\n",[315,366,368],{"class":317,"line":367},5,[315,369,371],{"emptyLinePlaceholder":370},true,"\n",[315,373,375,378],{"class":317,"line":374},6,[315,376,377],{"class":321},".layout__nav",[315,379,326],{"class":325},[315,381,383,386,388,391,394,397,399,402],{"class":317,"line":382},7,[315,384,385],{"class":321},"  flex",[315,387,335],{"class":325},[315,389,390],{"class":321},"0",[315,392,393],{"class":321}," 0",[315,395,396],{"class":321}," 12",[315,398,356],{"class":355},[315,400,401],{"class":325},";        ",[315,403,405],{"class":404},"sLBg1","\u002F* never grows, never shrinks: fixed 12rem *\u002F\n",[315,407,409],{"class":317,"line":408},8,[315,410,364],{"class":325},[315,412,414],{"class":317,"line":413},9,[315,415,371],{"emptyLinePlaceholder":370},[315,417,419,422],{"class":317,"line":418},10,[315,420,421],{"class":321},".layout__main",[315,423,326],{"class":325},[315,425,427,429,431,433,436,439,441,443],{"class":317,"line":426},11,[315,428,385],{"class":321},[315,430,335],{"class":325},[315,432,352],{"class":321},[315,434,435],{"class":321}," 1",[315,437,438],{"class":321}," 20",[315,440,356],{"class":355},[315,442,401],{"class":325},[315,444,445],{"class":404},"\u002F* starts at 20rem, takes all spare space, shrinks first *\u002F\n",[315,447,449,452,454,456,459],{"class":317,"line":448},12,[315,450,451],{"class":321},"  min-inline-size",[315,453,335],{"class":325},[315,455,390],{"class":321},[315,457,458],{"class":325},";     ",[315,460,461],{"class":404},"\u002F* allow shrinking below long content *\u002F\n",[315,463,465],{"class":317,"line":464},13,[315,466,364],{"class":325},[315,468,470],{"class":317,"line":469},14,[315,471,371],{"emptyLinePlaceholder":370},[315,473,475,478],{"class":317,"line":474},15,[315,476,477],{"class":321},".layout__aside",[315,479,326],{"class":325},[315,481,483,485,487,489,491,494,496,498],{"class":317,"line":482},16,[315,484,385],{"class":321},[315,486,335],{"class":325},[315,488,390],{"class":321},[315,490,435],{"class":321},[315,492,493],{"class":321}," 16",[315,495,356],{"class":355},[315,497,401],{"class":325},[315,499,500],{"class":404},"\u002F* 16rem when it fits, shrinks when it must, never grows *\u002F\n",[315,502,504],{"class":317,"line":503},17,[315,505,364],{"class":325},[14,507,508],{},"At wide sizes, the navigation stays at 12rem, the aside stays at 16rem, and the main area takes everything else because it is the only item that grows. As the frame narrows, overflow is shared between main and aside in proportion to basis × shrink, so the 20rem main area gives up more than the 16rem aside. The navigation never changes.",[37,510,512],{"id":511},"the-key-technique-the-automatic-minimum-size","The key technique: the automatic minimum size",[14,514,515,516,519,520,522,523,526],{},"Shrinking has a hard floor that surprises everyone once. A flex item's minimum main size defaults to ",[17,517,518],{},"auto",", which for most items resolves to its min-content size: the width of its longest word, widest image or fixed-width child. No amount of ",[17,521,211],{}," pushes an item below that floor. A main column containing a long URL or a wide ",[17,524,525],{},"\u003Cpre>"," block therefore refuses to shrink, and the layout overflows its container.",[14,528,529,530,56,533,536,537,540,541,544,545,548,549,553],{},"The fix is ",[17,531,532],{},"min-inline-size: 0",[17,534,535],{},"min-width: 0",") on the item, which removes the automatic floor, usually combined with ",[17,538,539],{},"overflow-wrap: anywhere"," or scrolling for the offending content. Setting ",[17,542,543],{},"overflow"," to anything other than ",[17,546,547],{},"visible"," also removes the floor, because scroll containers do not use the content-based minimum. ",[26,550,552],{"href":551},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Fpreventing-flex-and-grid-overflow\u002F","Preventing Flex and Grid Overflow"," covers the patterns in depth.",[37,555,557],{"id":556},"growing-on-wrapped-lines","Growing on wrapped lines",[14,559,560,561,564,565,568],{},"With ",[17,562,563],{},"flex-wrap: wrap",", the algorithms run once per line, not once for the whole container. Items are first broken into lines based on their bases; then free space on each line is shared only among the items on that line. That is why the last line of a wrapping row often looks different: two items on the final line split its whole width between them, while four items on a full line split a much smaller remainder. If every card should be the same width regardless of line, flexbox is the wrong tool — a grid with ",[17,566,567],{},"repeat(auto-fill, minmax(…))"," keeps columns consistent across rows.",[37,570,572],{"id":571},"seeing-the-numbers-in-devtools","Seeing the numbers in DevTools",[14,574,575],{},"Browser DevTools show the algorithm's results directly. In Chromium and Firefox, selecting a flex item shows its basis, the amount it grew or shrank, and whether it hit its minimum size — Firefox labels this explicitly as the item being \"clamped to its minimum size\". When a layout does not behave as the arithmetic above predicts, the minimum-size clamp is almost always the reason, and the panel confirms it in one glance.",[37,577,579],{"id":578},"flex-values-worth-memorising","Flex values worth memorising",[14,581,582,583,585],{},"The ",[17,584,338],{}," shorthand sets grow, shrink and basis together. Four values cover nearly every case:",[587,588,589,605,616,627],"ul",{},[590,591,592,597,598,601,602,604],"li",{},[593,594,595],"strong",{},[17,596,19],{}," — equals ",[17,599,600],{},"1 1 0%",". Zero basis, so every item shares the whole container. Items with ",[17,603,19],{}," end up equal widths regardless of content, subject to their minimum sizes.",[590,606,607,597,612,615],{},[593,608,609],{},[17,610,611],{},"flex: auto",[17,613,614],{},"1 1 auto",". Content-sized basis, then leftover space shared. Items with more content stay wider.",[590,617,618,597,623,626],{},[593,619,620],{},[17,621,622],{},"flex: none",[17,624,625],{},"0 0 auto",". Content-sized and rigid.",[590,628,629,634],{},[593,630,631],{},[17,632,633],{},"flex: 0 0 \u003Clength>"," — a fixed-size item, such as a sidebar.",[14,636,637,638,641],{},"The default, if you set nothing, is ",[17,639,640],{},"flex: 0 1 auto",": items do not grow, may shrink, and start from their content size. That default is why a row of items without any flex declarations sits at the start of the container and only compresses when it runs out of room.",[37,643,645],{"id":644},"growing-and-shrinking-in-columns","Growing and shrinking in columns",[14,647,648,649,652,653,655,656,659,660,664],{},"Everything above applies to ",[17,650,651],{},"flex-direction: column",", but column containers usually have no definite height, so there is no free space to share and nothing to shrink against: the container simply grows to fit its items. ",[17,654,23],{}," in a column only has an effect when the container has a height, such as a full-viewport layout with ",[17,657,658],{},"min-block-size: 100dvh",". That is the basis of the sticky-footer pattern in ",[26,661,663],{"href":662},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fsticky-footer-with-flexbox-and-grid\u002F","Sticky Footer With Flexbox and Grid",".",[37,666,668],{"id":667},"browser-support","Browser support",[14,670,671,672,674,675,678,679,683,684,687],{},"Flexbox, the ",[17,673,338],{}," shorthand and the automatic minimum size behave consistently in every current browser. The ",[17,676,677],{},"gap"," property for flex containers is also supported everywhere current; older browsers that predate it lay out the items without spacing, so ",[26,680,682],{"href":681},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fflexbox-gap-and-spacing\u002F","Flexbox Gap and Spacing"," discusses margin-based fallbacks if very old engines matter. The ",[17,685,686],{},"min-content"," keyword used in related sizing is supported in Chrome 46+, Edge 79+, Firefox 66+ and Safari 11+.",[37,689,691],{"id":690},"faq","FAQ",[14,693,694,697,698,700,701,703,704,706],{},[593,695,696],{},"How does flex-grow divide space?","\nThe free space left after every item's flex-basis is placed is split in proportion to the ",[17,699,23],{}," values. Items with ",[17,702,86],{}," receive twice as much of the leftover space as items with ",[17,705,82],{},", not twice the final width.",[14,708,709,712,714,715,717,718,720],{},[593,710,711],{},"Why do my items with equal flex-shrink shrink by different amounts?",[17,713,211],{}," is weighted by each item's flex-basis. The overflow is distributed in proportion to ",[17,716,211],{}," multiplied by basis, so a large item gives up more pixels than a small one with the same ",[17,719,211],{}," value.",[14,722,723,726,727,729,730,732,733,735],{},[593,724,725],{},"Why won't my flex item shrink below its content?","\nFlex items have an automatic minimum size of min-content in the main axis. Long words, images or fixed-width children set a floor the item cannot shrink past. Set ",[17,728,532],{}," or ",[17,731,543],{}," other than ",[17,734,547],{}," to remove it.",[14,737,738,741,743,744,746],{},[593,739,740],{},"What is the difference between flex: 1 and flex: auto?",[17,742,19],{}," sets the basis to 0, so all free space is shared and items end up equal widths regardless of content. ",[17,745,611],{}," keeps the content-based basis and shares only the leftover space, so items with more content stay wider.",[37,748,750],{"id":749},"related","Related",[587,752,753,758,763,770],{},[590,754,755,757],{},[26,756,29],{"href":28}," — the parent guide.",[590,759,760,762],{},[26,761,64],{"href":63}," — where each item starts.",[590,764,765,769],{},[26,766,768],{"href":767},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fflex-wrap-intrinsic-responsive-rows\u002F","flex-wrap for Intrinsic Responsive Rows"," — growing items across wrapped lines.",[590,771,772,774],{},[26,773,552],{"href":551}," — the minimum-size floor in practice.",[776,777,778],"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 .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":311,"searchDepth":329,"depth":329,"links":780},[781,782,783,784,785,786,787,788,789,790,791,792],{"id":39,"depth":329,"text":40},{"id":68,"depth":329,"text":69},{"id":204,"depth":329,"text":205},{"id":296,"depth":329,"text":297},{"id":511,"depth":329,"text":512},{"id":556,"depth":329,"text":557},{"id":571,"depth":329,"text":572},{"id":578,"depth":329,"text":579},{"id":644,"depth":329,"text":645},{"id":667,"depth":329,"text":668},{"id":690,"depth":329,"text":691},{"id":749,"depth":329,"text":750},"How flexbox shares free space and absorbs overflow: flex-grow ratios, why flex-shrink is weighted by basis, the min-content floor, and flex values that behave.","md",{"pageTitle":5,"datePublished":796,"dateModified":796,"faq":797},"2026-09-18",[798,800,802,804],{"q":696,"a":799},"The free space left after every item's flex-basis is placed is split in proportion to the flex-grow values. Items with flex-grow 2 receive twice as much of the leftover space as items with flex-grow 1, not twice the final width.",{"q":711,"a":801},"flex-shrink is weighted by each item's flex-basis. The overflow is distributed in proportion to flex-shrink multiplied by basis, so a large item gives up more pixels than a small one with the same flex-shrink value.",{"q":725,"a":803},"Flex items have an automatic minimum size of min-content in the main axis. Long words, images or fixed-width children set a floor the item cannot shrink past. Set min-inline-size: 0 or overflow other than visible to remove it.",{"q":740,"a":805},"flex: 1 sets the basis to 0, so all free space is shared and items end up equal widths regardless of content. flex: auto keeps the content-based basis and shares only the leftover space, so items with more content stay wider.","\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fflex-grow-and-flex-shrink-explained",{"title":5,"description":793},"mastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fflex-grow-and-flex-shrink-explained\u002Findex","8HBGDpKDeTa67zHUPWSpxnsHTjjDb0cB8c4tkp4YoHo",[811,814,817,820,823,826,829,832,835,838,841,844,847,850,853,856,859,862,865,868,871,874,877,880,883,886,889,892,895,898,901,904,907,910,913,916,919,922,925,928,931,934,937,940,943,946,949,952,955,958,961,964,967,970,973,976,979,982,985,988,991,994,997,1000,1003,1006,1009,1012,1015,1018,1021,1024,1027,1030,1033,1036,1039,1042,1045,1048,1051,1054,1057,1060,1063,1066,1069,1072,1075,1078,1081,1084,1087,1090,1093,1096,1099,1102,1105,1108,1111,1114,1117,1120,1123,1126,1129,1132,1135,1138,1141,1144,1147,1150,1153,1156,1159,1162,1165,1168,1171,1174,1177,1180,1183,1186,1189,1192,1193,1196,1199,1202,1205,1208,1211,1214,1217,1220,1223,1226,1229,1231,1234,1237,1240,1243,1246,1249,1252,1255,1258,1261,1264,1267,1270,1273,1276,1279,1282,1285,1288,1291,1294,1297,1300,1303,1306,1309,1312,1315,1318,1321,1324,1327,1330,1333,1336,1339,1342,1345,1348,1351,1354,1357,1360,1363,1366],{"path":812,"title":813},"\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":815,"title":816},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fflashing-content-and-seizure-thresholds","Flashing Content and Seizure Thresholds",{"path":818,"title":819},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fforced-colors-mode-and-animations","Forced Colors Mode and Animations",{"path":821,"title":822},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations","Accessibility in CSS Animations: Patterns, Specs & Best Practices",{"path":824,"title":825},"\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":827,"title":828},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fprefers-reduced-motion-recipes","prefers-reduced-motion Recipes: A Reduction for Every Common Effect",{"path":830,"title":831},"\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":833,"title":834},"\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":836,"title":837},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fvestibular-safe-animation-patterns","Vestibular-Safe Animation Patterns: Why Some Motion Makes People Sick",{"path":839,"title":840},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fwcag-motion-success-criteria","WCAG Motion Success Criteria: What Each One Actually Requires",{"path":842,"title":843},"\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":845,"title":846},"\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":848,"title":849},"\u002Fcss-only-micro-interactions-animations\u002Fclip-path-and-mask-animations","Clip-Path & Mask Animations: Animating Visibility Instead of Position",{"path":851,"title":852},"\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":854,"title":855},"\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":857,"title":858},"\u002Fcss-only-micro-interactions-animations\u002Fcolor-and-theme-transitions\u002Fanimating-gradients","Animating CSS Gradients: Smooth Colour Motion Without Jumps",{"path":860,"title":861},"\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":863,"title":864},"\u002Fcss-only-micro-interactions-animations\u002Fcolor-and-theme-transitions","Color & Theme Transitions: Colour as Part of the Motion System",{"path":866,"title":867},"\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":869,"title":870},"\u002Fcss-only-micro-interactions-animations\u002Fcolor-and-theme-transitions\u002Fsmooth-theme-switching-transitions","Smooth Theme Switching: Crossfades, Circular Reveals and No Flash",{"path":872,"title":873},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion\u002Fcontainer-query-hover-affordances","Container Query Hover Affordances: When Narrow Means Persistent, Not Hidden",{"path":875,"title":876},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion","Container-Aware Motion: Animation Sized by the Space a Component Actually Has",{"path":878,"title":879},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion\u002Flayout-change-animations-at-container-breakpoints","Animating Changes at Container Breakpoints",{"path":881,"title":882},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion\u002Fmotion-driven-by-container-style-queries","Motion Driven by Container Style Queries",{"path":884,"title":885},"\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":887,"title":888},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion\u002Fsuppressing-motion-in-small-containers","Suppressing Motion in Small Containers: Deliberately Animating Nothing",{"path":890,"title":891},"\u002Fcss-only-micro-interactions-animations\u002Fcss-animation-vs-web-animations-api\u002Fcontrolling-css-animations-from-javascript","Controlling CSS Animations From JavaScript",{"path":893,"title":894},"\u002Fcss-only-micro-interactions-animations\u002Fcss-animation-vs-web-animations-api","CSS Animation vs the Web Animations API: A Decision Guide",{"path":896,"title":897},"\u002Fcss-only-micro-interactions-animations\u002Fcss-animation-vs-web-animations-api\u002Fwaapi-vs-css-for-interruptible-ui","Interruptible UI: CSS Transitions vs WAAPI",{"path":899,"title":900},"\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":902,"title":903},"\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":905,"title":906},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture\u002Fcustom-property-fallbacks-and-invalid-values","Custom Property Fallbacks and Invalid Values",{"path":908,"title":909},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture\u002Ffluid-spacing-tokens-driving-transition-durations","Fluid Spacing Tokens That Drive Transition Durations",{"path":911,"title":912},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture","CSS Custom Properties Architecture: Scalable Design Systems & Dynamic UI",{"path":914,"title":915},"\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":917,"title":918},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture\u002Fscoping-custom-properties-to-components","Scoping Custom Properties to Components",{"path":920,"title":921},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Fcss-transition-timing-functions","CSS Transition Timing Functions: ease, cubic-bezier(), steps() and linear()",{"path":923,"title":924},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals","CSS Transition Fundamentals: Architecture, Performance & Patterns",{"path":926,"title":927},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Finterrupted-and-reversing-transitions","Interrupted and Reversing Transitions: What Happens Mid-Flight",{"path":929,"title":930},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Fstarting-style-entry-animations","@starting-style: Animating an Element's Very First Style Change",{"path":932,"title":933},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Ftransition-delay-choreography","Choreographing Motion With transition-delay",{"path":935,"title":936},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Ftransition-shorthand-and-multiple-properties","The transition Shorthand and Multiple Properties",{"path":938,"title":939},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Ftransitioning-display-with-allow-discrete","Transitioning display with transition-behavior: allow-discrete and @starting-style",{"path":941,"title":942},"\u002Fcss-only-micro-interactions-animations\u002Fdialog-and-popover-animations\u002Fanimating-dialog-open-and-close","Animating \u003Cdialog> Open and Close: Both Directions, No Library",{"path":944,"title":945},"\u002Fcss-only-micro-interactions-animations\u002Fdialog-and-popover-animations\u002Fbackdrop-animations","Animating ::backdrop: Fades and Blurs Behind Dialogs and Popovers",{"path":947,"title":948},"\u002Fcss-only-micro-interactions-animations\u002Fdialog-and-popover-animations","Dialog & Popover Animations: Motion for the Top Layer",{"path":950,"title":951},"\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":953,"title":954},"\u002Fcss-only-micro-interactions-animations\u002Fdialog-and-popover-animations\u002Fpopover-entry-and-exit-transitions","Popover Menus That Animate From Their Anchor",{"path":956,"title":957},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design\u002Fchoosing-animation-durations","Choosing Animation Durations: How Long Motion Should Last",{"path":959,"title":960},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design\u002Fcubic-bezier-overshoot-and-anticipation","Overshoot and Anticipation With cubic-bezier(): Motion With Character",{"path":962,"title":963},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design\u002Fentry-vs-exit-easing","Entry vs Exit Easing: Different Curves for Arriving and Leaving",{"path":965,"title":966},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design","Easing & Motion Design: Making CSS Motion Feel Intentional",{"path":968,"title":969},"\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":971,"title":972},"\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":974,"title":975},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design\u002Faccessible-css-only-tooltips","Accessible CSS-Only Tooltips and Hover Cards With  and ",{"path":977,"title":978},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design\u002Fbutton-press-and-active-states","Button Press and  States",{"path":980,"title":981},"\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":983,"title":984},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design\u002Ffocus-within-form-patterns"," Form Patterns: Styling a Group From the Field Inside It",{"path":986,"title":987},"\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":989,"title":990},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design","Hover & Focus State Design: Spec-Compliant Patterns for Modern UIs",{"path":992,"title":993},"\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":995,"title":996},"\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":998,"title":999},"\u002Fcss-only-micro-interactions-animations","CSS-Only Micro-Interactions & Animations: Architecture, Performance & Implementation",{"path":1001,"title":1002},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fanimation-composition-and-stacking","Stacking Animations With animation-composition",{"path":1004,"title":1005},"\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":1007,"title":1008},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fcontainer-query-triggered-keyframe-animations","Container-Query-Triggered Keyframe Animations: Animate Differently per Available Space",{"path":1010,"title":1011},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fcss-only-accordions-and-disclosure","CSS-Only Accordions and Disclosure Widgets with details and summary",{"path":1013,"title":1014},"\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":1016,"title":1017},"\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":1019,"title":1020},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns","Keyframe Animation Patterns: Spec-Compliant Architectures for Modern UIs",{"path":1022,"title":1023},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fmulti-step-keyframes-and-per-keyframe-easing","Multi-Step Keyframes and Per-Keyframe Easing",{"path":1025,"title":1026},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fstaggered-list-animations-with-custom-properties","Staggered List Animations Using --i Index Custom Properties",{"path":1028,"title":1029},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Fanimating-box-shadow-and-filters-cheaply","Animating box-shadow and Filters Cheaply",{"path":1031,"title":1032},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Fcontain-property-for-animation-performance","The contain Property for Animation Performance",{"path":1034,"title":1035},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Fcss-triggers-layout-paint-composite","Layout, Paint and Composite: What Triggers What",{"path":1037,"title":1038},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration","Performance & GPU Acceleration in CSS: A Developer’s Blueprint",{"path":1040,"title":1041},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Foptimizing-css-animations-for-60fps","Optimizing CSS Animations for 60fps: Budgeting the Frame",{"path":1043,"title":1044},"\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":1046,"title":1047},"\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":1049,"title":1050},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations","Scroll-Driven Animations: Binding Motion to Scroll Position in Pure CSS",{"path":1052,"title":1053},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fscroll-driven-animation-fallbacks","Shipping Scroll-Driven Animations Without Breaking Anything",{"path":1055,"title":1056},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fscroll-driven-parallax-effects","Scroll-Driven Parallax Effects in CSS",{"path":1058,"title":1059},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fscroll-progress-bar-without-javascript","A Reading Progress Bar Driven by scroll(root)",{"path":1061,"title":1062},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fscroll-triggered-reveal-animations","Reveal-on-Scroll with view() and animation-range",{"path":1064,"title":1065},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Ftimeline-scope-for-cross-element-animations","timeline-scope for Cross-Element Animations",{"path":1067,"title":1068},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fview-timeline-and-animation-range","View Timelines and animation-range",{"path":1070,"title":1071},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fcross-document-view-transitions","Cross-Document View Transitions",{"path":1073,"title":1074},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers","View Transitions for CSS Developers: the Pseudo-Element Tree, Snapshots, and Named Elements",{"path":1076,"title":1077},"\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":1079,"title":1080},"\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":1082,"title":1083},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fview-transition-types-and-classes","View Transition Types and Classes",{"path":1085,"title":1086},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fview-transitions-for-list-reordering","View Transitions for List Reordering",{"path":1088,"title":1089},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fview-transitions-with-reduced-motion","Honouring prefers-reduced-motion in View Transitions",{"path":1091,"title":1092},"\u002F","Modern CSS Layouts & Micro-Interactions",{"path":1094,"title":1095},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fanchor-positioned-tooltips","Anchor-Positioned Tooltips: Tethering, Flipping, and Getting the Semantics Right",{"path":1097,"title":1098},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fanchor-positioning-fallbacks","Anchor Positioning Fallbacks: A Graceful Floor for Older Browser Versions",{"path":1100,"title":1101},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fanchor-size-for-matching-widths","anchor-size(): Overlays That Match Their Trigger's Size",{"path":1103,"title":1104},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays","CSS Anchor Positioning and Overlays: Tethering Elements Without JavaScript",{"path":1106,"title":1107},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fpopover-attribute-and-css-styling","The popover Attribute: Top-Layer Overlays With No JavaScript",{"path":1109,"title":1110},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fpopover-light-dismiss-and-stacking","Popover Light Dismiss, Nesting and Stacking",{"path":1112,"title":1113},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fposition-area-grid-explained","position-area: The Anchor Placement Grid",{"path":1115,"title":1116},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Fcontainer-query-polyfill-tradeoffs","Container Query Polyfills: What They Cost and When to Skip Them",{"path":1118,"title":1119},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Ffeature-detection-with-supports","Feature Detection with @supports: Syntax, Semantics, and the Traps",{"path":1121,"title":1122},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Fhandling-container-query-fallbacks-for-older-browsers","Handling Container Query Fallbacks for Older Browsers",{"path":1124,"title":1125},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks","Container Query Fallbacks: Spec-Compliant CSS Strategies for Legacy Browsers",{"path":1127,"title":1128},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Fintrinsic-layout-fallbacks-without-queries","Intrinsic Layout Fallbacks: Baselines That Adapt Without Any Query",{"path":1130,"title":1131},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Ftesting-fallbacks-without-old-browsers","Testing CSS Fallbacks Without an Old Browser",{"path":1133,"title":1134},"\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":1136,"title":1137},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fcontainer-query-range-and-logic-operators","Container Query Range Syntax and Logic Operators",{"path":1139,"title":1140},"\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":1142,"title":1143},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fcontainer-type-size-vs-inline-size","Choosing container-type: inline-size, size, or normal",{"path":1145,"title":1146},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fcontainer-vs-media-queries-comparison","Container vs Media Queries: Choosing the Right Reference Box",{"path":1148,"title":1149},"\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":1151,"title":1152},"\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":1154,"title":1155},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics","Container Query Syntax Basics",{"path":1157,"title":1158},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fnesting-and-naming-container-queries","Nesting and Naming Container Queries: Targeting the Right Ancestor",{"path":1160,"title":1161},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fauto-fit-minmax-responsive-grids","Responsive Grids with repeat(auto-fit, minmax())",{"path":1163,"title":1164},"\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":1166,"title":1167},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fgrid-auto-flow-dense-packing","grid-auto-flow: dense for Packed Layouts",{"path":1169,"title":1170},"\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":1172,"title":1173},"\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":1175,"title":1176},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts","CSS Grid and Subgrid Layouts for Responsive Interfaces",{"path":1178,"title":1179},"\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":1181,"title":1182},"\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":1184,"title":1185},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fsubgrid-vs-nested-grid","Subgrid vs an Independently Nested Grid",{"path":1187,"title":1188},"\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":1190,"title":1191},"\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":806,"title":5},{"path":1194,"title":1195},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fflex-wrap-intrinsic-responsive-rows","Breakpoint-Free Responsive Rows With flex-wrap and flex-basis",{"path":1197,"title":1198},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fflexbox-gap-and-spacing","Flexbox gap vs Margins: Spacing Items Without Edge Hacks",{"path":1200,"title":1201},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns","Flexbox Layout Patterns: One-Dimensional Layout for Real Components",{"path":1203,"title":1204},"\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":1206,"title":1207},"\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":1209,"title":1210},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp\u002Fdebugging-clamp-values","Debugging clamp(): Values That Are Ignored, Stuck or Never Fluid",{"path":1212,"title":1213},"\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":1215,"title":1216},"\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":1218,"title":1219},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp\u002Ffluid-type-accessibility-and-zoom","Fluid Type, Accessibility and Zoom: The vw-Only Trap",{"path":1221,"title":1222},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp\u002Ffluid-typography-without-javascript","Fluid Typography Without JavaScript: A Precision CSS Reference",{"path":1224,"title":1225},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp","Fluid Typography with clamp(): A Practical Guide for Modern CSS",{"path":1227,"title":1228},"\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":1230,"title":34},"\u002Fmastering-container-queries-responsive-layouts",{"path":1232,"title":1233},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Faspect-ratio-for-responsive-media","Using aspect-ratio for Responsive Media and Preventing Layout Shift",{"path":1235,"title":1236},"\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":1238,"title":1239},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques","Intrinsic Sizing Techniques: Modern CSS Layouts for Responsive UI",{"path":1241,"title":1242},"\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":1244,"title":1245},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Fmin-max-fit-content-explained","min-content, max-content, and fit-content() Explained",{"path":1247,"title":1248},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Fobject-fit-and-object-position","object-fit and object-position: Images That Fit Any Box",{"path":1250,"title":1251},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Fpreventing-flex-and-grid-overflow","The min-width: auto Trap in Flex and Grid Layouts",{"path":1253,"title":1254},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies\u002Fcascade-layers-for-reset-and-tokens","Cascade Layers for Reset and Design Tokens",{"path":1256,"title":1257},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies\u002Fcascade-layers-vs-specificity-hacks","Cascade Layers vs Specificity Hacks: Ordering Instead of Escalating",{"path":1259,"title":1260},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies\u002Fcss-scope-for-component-styles","@scope for Component Styles: Short Selectors That Cannot Leak",{"path":1262,"title":1263},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies","Modern CSS Reset Strategies: A Spec-Compliant Foundation",{"path":1265,"title":1266},"\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":1268,"title":1269},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies\u002Fwriting-a-minimal-modern-reset","Writing a Minimal Modern CSS Reset: Every Line Justified",{"path":1271,"title":1272},"\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":1274,"title":1275},"\u002Fmastering-container-queries-responsive-layouts\u002Fparent-aware-layouts-with-has\u002Fempty-and-loading-states-with-has","Empty and Loading States With ()",{"path":1277,"title":1278},"\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":1280,"title":1281},"\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":1283,"title":1284},"\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":1286,"title":1287},"\u002Fmastering-container-queries-responsive-layouts\u002Fparent-aware-layouts-with-has","Parent-Aware Layouts With :has(): Letting Containers React to Their Contents",{"path":1289,"title":1290},"\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":1292,"title":1293},"\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":1295,"title":1296},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fcontainer-query-data-tables","Container Query Data Tables: Reflowing Tables to Cards",{"path":1298,"title":1299},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fcontainer-query-sidebar-layouts","Container Query Sidebar Layouts That Travel Between Contexts",{"path":1301,"title":1302},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns","Responsive Component Patterns: Architecture & Implementation",{"path":1304,"title":1305},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fresponsive-forms-with-container-queries","Responsive Forms with Container Queries: Reflow Without Losing the Wiring",{"path":1307,"title":1308},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fresponsive-hero-sections-with-container-queries","Responsive Hero Sections With Container Queries",{"path":1310,"title":1311},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fresponsive-navigation-without-media-queries","Responsive Navigation Without Media Queries Using Container Queries",{"path":1313,"title":1314},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fresponsive-pricing-tables","Responsive Pricing Tables: Aligned Features, a Clear Recommendation, Any Width",{"path":1316,"title":1317},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Ftabs-that-become-accordions","Tabs That Become an Accordion: One Component, Two Layouts",{"path":1319,"title":1320},"\u002Fmastering-container-queries-responsive-layouts\u002Fscroll-snap-and-overflow-layouts\u002Fcss-only-carousel-with-scroll-snap","A CSS-Only Carousel With Scroll Snap",{"path":1322,"title":1323},"\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":1325,"title":1326},"\u002Fmastering-container-queries-responsive-layouts\u002Fscroll-snap-and-overflow-layouts","Scroll Snap & Overflow Layouts: Designing Components That Scroll on Purpose",{"path":1328,"title":1329},"\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":1331,"title":1332},"\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":1334,"title":1335},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state\u002Fcombining-size-and-style-queries","Combining Size and Style Container Queries",{"path":1337,"title":1338},"\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":1340,"title":1341},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state","Style Queries and Container State: Token-Driven Component Variants",{"path":1343,"title":1344},"\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":1346,"title":1347},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state\u002Fstyle-query-component-variants","Component Variants With Style Queries: One Token, Many Looks",{"path":1349,"title":1350},"\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":1352,"title":1353},"\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":1355,"title":1356},"\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":1358,"title":1359},"\u002Fmastering-container-queries-responsive-layouts\u002Fviewport-units-and-mobile-layout","Viewport Units & Mobile Layout: Designing for the Screen You Actually Get",{"path":1361,"title":1362},"\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":1364,"title":1365},"\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":1367,"title":1368},"\u002Fmastering-container-queries-responsive-layouts\u002Fviewport-units-and-mobile-layout\u002Fvirtual-keyboard-and-interactive-widget","Layouts That Survive the Virtual Keyboard",{"title":1370,"caption":1371,"height":1372,"resizable":370,"html":1373,"css":1374},"Fixed, growing and shrinking flex items","Drag the frame narrower and wider. The nav stays 12rem (flex: 0 0 12rem), main takes all spare space (flex: 1 1 20rem), and the aside keeps 16rem until it has to shrink (flex: 0 1 16rem).",220,"\n\u003Cdiv class=\"layout\">\n  \u003Cnav class=\"layout__nav\">nav\u003Cbr>\u003Ccode>0 0 12rem\u003C\u002Fcode>\u003C\u002Fnav>\n  \u003Cmain class=\"layout__main\">main\u003Cbr>\u003Ccode>1 1 20rem\u003C\u002Fcode>\u003C\u002Fmain>\n  \u003Caside class=\"layout__aside\">aside\u003Cbr>\u003Ccode>0 1 16rem\u003C\u002Fcode>\u003C\u002Faside>\n\u003C\u002Fdiv>","\n.layout { display: flex; gap: 1rem; padding: 1rem; }\n.layout > * { padding: 1rem; border-radius: 8px; border: 1px solid var(--demo-border); min-block-size: 8rem; font-weight: 600; }\n.layout code { font-weight: 400; font-size: 0.8rem; color: var(--demo-muted); }\n.layout__nav { flex: 0 0 12rem; background: var(--demo-surface); }\n.layout__main { flex: 1 1 20rem; min-inline-size: 0; background: color-mix(in srgb, var(--demo-accent) 18%, var(--demo-surface)); }\n.layout__aside { flex: 0 1 16rem; background: var(--demo-surface); }",1789717744838]