All cases
RL-003 / Flexbox & GridEvidence verified

`1fr` vs `minmax(0, 1fr)`: Prevent Grid Overflow

A flexible grid track keeps an automatic minimum based on long content and expands beyond the available inline size.

Experiment mode

Fixture viewport

Failinggrid: 88px 1fr
Viewport / page
--
Grid track
--
Page overflow
--
Fixedgrid: 88px minmax(0, 1fr)
Viewport / page
--
Grid track
--
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 `1fr` track keeps its automatic minimum

The second track is flexible, but its minimum is still automatic. A long unbroken command gives the track a min-content floor larger than the remaining space.

Minimal code diff

Give the flexible track a zero minimum

Use `minmax(0, 1fr)` for the track that may shrink, then define local overflow behavior for its wide child.

Before

.result-grid {
  grid-template-columns: 88px 1fr;
}

After

.result-grid {
  grid-template-columns: 88px minmax(0, 1fr);
}
.result-output {
  min-width: 0;
  overflow-x: auto;
}

Root cause

An fr unit distributes leftover space, but a track written as 1fr still has an automatic minimum. When a grid item contains a long unbroken value, that content can establish a minimum wider than the free space. The track then grows and the document overflows.

minmax(0, 1fr) makes the intended lower bound explicit. The track can become smaller than its min-content contribution while continuing to receive the remaining space.

Confirm which track establishes the floor

Use the browser’s grid inspector and compare the grid’s content width with the long item’s scroll width. In the controlled fixture, the fixed first track is stable and the nominally flexible second track expands. Replacing only that second track with minmax(0, 1fr) makes the grid fit immediately, which distinguishes the track-sizing cause from padding, viewport units, or an unrelated fixed-width ancestor.

The item inside the track still needs its own content decision. The fixture gives its command output a local scroll area because preserving the exact string matters. A translated label or normal paragraph would use wrapping instead. Testing both the grid boundary and the descendant’s reachability prevents a zero minimum from becoming an accidental clipping technique.

When this fix is not enough

The wide descendant still needs an intentional behavior. Code and data may use a reachable local scrollbar, while ordinary prose may need wrapping. A zero track minimum should not be used to hide clipped controls or inaccessible content.

Regression condition

At narrow viewports, the failing grid should produce page-level overflow. The fixed grid must remain within the page, and its long command must remain accessible through the local output region.

Primary references

Sources checked for this case

  1. CSS Grid Layout Module Level 2 - flexible lengths - 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+164 / +0+109 / +0+0 / +0+0 / +0+0 / +0
Firefox+164 / +0+109 / +0+0 / +0+0 / +0+0 / +0
WebKit+195 / +0+140 / +0+0 / +0+0 / +0+0 / +0
18/18 recorded assertions passed
  • chromium-failing-overflow-320164px
  • chromium-fixed-overflow-3200px
  • chromium-fixed-local-scroll-320204px
  • chromium-failing-overflow-375109px
  • chromium-fixed-overflow-3750px
  • chromium-fixed-local-scroll-375149px
  • firefox-failing-overflow-320164px
  • firefox-fixed-overflow-3200px
  • firefox-fixed-local-scroll-320204px
  • firefox-failing-overflow-375109px
  • firefox-fixed-overflow-3750px
  • firefox-fixed-local-scroll-375149px
  • webkit-failing-overflow-320195px
  • webkit-fixed-overflow-3200px
  • webkit-fixed-local-scroll-320235px
  • webkit-failing-overflow-375140px
  • webkit-fixed-overflow-3750px
  • webkit-fixed-local-scroll-375180px