Description
The CSS Sizing specification defines the following:
max-content block size
The box’s “ideal” size in the block axis—usually the block size of the content after layout.
min-content block size
The minimum content size in the block axis. For block containers, tables, and inline boxes, this is equivalent to the max-content block size.
fit-content block size
Defined as:
max(min-content size, min(max-content size, stretch-fit size))
When the min-content size equals the max-content size, the stretch-fit
term has no effect, and this simplifies to:
fit-content block size = min-content block size = max-content block size
In Flexbox, the hypothetical cross size of a flex item is determined by performing layout as if it were an in-flow block-level box with the used main size and the given available space, treating auto
as fit-content
. Similarly, the Grid specification treats a grid item’s min-content contribution as an intrinsic size. Together, these imply that the min-content
, max-content
, and fit-content
keywords all resolve identically for block-axis sizing in both flex and grid layouts.
However, reading the spec literally, one might assume that these keywords introduce distinct block-axis sizing behaviors. In practice, though, they appear to always resolve to the same value. This redundancy may add unnecessary complexity for authors trying to understand or reason about intrinsic block sizing.
Are there any real-world or edge-case scenarios where the block-axis min-content
, max-content
, and fit-content
sizes differ? If not, would it improve clarity to state:
On the block axis,
min-content
,max-content
, andfit-content
always resolve to the same size.
This clarification could help reduce confusion and avoid overthinking intrinsic block sizing in layouts.