-
Notifications
You must be signed in to change notification settings - Fork 715
[css-sizing-3] Clarify equivalence of min-content, max-content, and fit-content on the block axis #12103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
No. This is not true for flex containers nor See example in #6457 (comment) |
How is that not true? The spec quote is crystal clear when it comes to block containers:
If min-content and max-content on the block axis are equal for block containers, then plugging those into the |
Flex/grid containers are not block containers. |
I never claimed that flex or grid containers are block containers. My point was that, on the block axis, min-content, max-content, and fit-content all produce the same value for the item’s block size. Do you know of a case where these would differ for a flex item, for example? |
OK, I made a typo, I wanted to say "This is not true for flex containers nor grid containers" |
I suspect no browser follows the spec because its wording is overly convoluted. For example, in the grid section you cited, it states:
Then it defines:
But how can the grid container’s own containing block impose a constraint on itself? It’s unclear. A much clearer wording would be:
The flexbox spec isn’t any clearer. In section 9.9.2 “Flex Container Intrinsic Cross Sizes”, it doesn’t distinguish between cc @fantasai |
The CSS Sizing specification defines the following:
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
asfit-content
. Similarly, the Grid specification treats a grid item’s min-content contribution as an intrinsic size. Together, these imply that themin-content
,max-content
, andfit-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
, andfit-content
sizes differ? If not, would it improve clarity to state:This clarification could help reduce confusion and avoid overthinking intrinsic block sizing in layouts.
The text was updated successfully, but these errors were encountered: