Skip to content

[css-sizing-3] Clarify equivalence of min-content, max-content, and fit-content on the block axis #12103

Closed
@gitspeaks

Description

@gitspeaks

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, and fit-content always resolve to the same size.

This clarification could help reduce confusion and avoid overthinking intrinsic block sizing in layouts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Closed as Question AnsweredUsed when the issue is more of a question than a problem, and it's been answered.css-sizing-3Current Work

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions