All cases
RL-002 / Flexbox & GridEvidence verified

Why Flex Items Refuse to Shrink: `min-width: auto`

A flex item keeps a content-based automatic minimum size and forces a row wider than a narrow viewport even when shrinking is enabled.

Experiment mode

Fixture viewport

Failingmin-width: auto
Viewport / page
--
Flex item
--
Page overflow
--
Fixedmin-width: 0
Viewport / page
--
Flex item
--
Page overflow
--

Three-browser evidence verified. Live values come from your current browser. The formal matrix records the controlled browser runs and fixture revision used for the published conclusion.

Observed failure

The text column keeps a content-sized floor

The filename has no convenient wrapping point. The middle flex item keeps its automatic minimum inline size, so its code block contributes a width larger than the available row.

Minimal code diff

Allow the flex item to shrink

Set the flexible item minimum inline size to zero and keep unavoidable scrolling local to the code region.

Before

.build-copy {
  flex: 1 1 auto;
}

After

.build-copy {
  flex: 1 1 auto;
  min-width: 0;
}
.build-copy pre {
  max-width: 100%;
  overflow-x: auto;
}

Root cause

A flex item has an automatic minimum size by default. Depending on its overflow and content, that minimum can be based on the min-content width. The item can therefore refuse to become narrower than a long unbroken descendant.

Setting min-width: 0 on the flexible item permits it to shrink below that content-based floor. This does not decide how every child should render, so a wide code or data region still needs an intentional local overflow or wrapping policy.

Diagnose the flex item, not only its child

Measure the flex container, each direct flex item, and the long descendant separately. The failing signal in this fixture is a flexible item whose rendered width stays near its min-content contribution even though the row has less available space. A temporary min-inline-size: 0 on that direct item should reduce the page width immediately; applying the same declaration only to the nested pre does not change the flex item’s automatic floor.

After the item shrinks, verify that the child still has a deliberate behavior. Ordinary prose should reflow, while the exact filename in this case remains available through the labeled local code region. This second check prevents a visually narrow layout from passing by clipping the content that originally exposed the sizing problem.

When this fix is not enough

Apply the rule to the flex item that needs to shrink, not indiscriminately to every descendant. If the page is still wide, measure all ancestor and child bounds; fixed-width media, transforms, negative margins, and nested grid tracks are separate mechanisms.

Regression condition

The failing fixture should overflow at the narrow test viewports. The fixed fixture must keep the page width stable while the long filename remains reachable inside its local scroll container.

Primary references

Sources checked for this case

  1. CSS Flexible Box Layout Module Level 1 - automatic minimum size - W3C, checked 2026-08-04

Formal evidence

Browser and viewport matrix

Three-browser run

Cells show failing / fixed page overflow in CSS pixels.

Browser32037576810241440
Chromium+144 / +0+89 / +0+0 / +0+0 / +0+0 / +0
Firefox+145 / +0+90 / +0+0 / +0+0 / +0+0 / +0
WebKit+172 / +0+117 / +0+0 / +0+0 / +0+0 / +0
18/18 recorded assertions passed
  • chromium-failing-overflow-320144px
  • chromium-fixed-overflow-3200px
  • chromium-fixed-local-scroll-320184px
  • chromium-failing-overflow-37589px
  • chromium-fixed-overflow-3750px
  • chromium-fixed-local-scroll-375129px
  • firefox-failing-overflow-320145px
  • firefox-fixed-overflow-3200px
  • firefox-fixed-local-scroll-320185px
  • firefox-failing-overflow-37590px
  • firefox-fixed-overflow-3750px
  • firefox-fixed-local-scroll-375130px
  • webkit-failing-overflow-320172px
  • webkit-fixed-overflow-3200px
  • webkit-fixed-local-scroll-320212px
  • webkit-failing-overflow-375117px
  • webkit-fixed-overflow-3750px
  • webkit-fixed-local-scroll-375157px