Skip to content

[css-flexbox-1] Clarify min-content and max-content sizing on the block axis #12108

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

Open
gitspeaks opened this issue Apr 22, 2025 · 2 comments
Open

Comments

@gitspeaks
Copy link

The spec doesn’t clearly explain how the min-content keyword affect the block size of flex containers. The behavior differs from max-content (see #6457 (comment)), but this isn’t intuitive (see #6457 (comment)), and no browser seems to follow the spec (see #12103 (comment)).

Also, section 9.9.3 lacks definitions for a flex item's cross-size min/max-content contributions.

Please clarify these points in the spec.

@gitspeaks gitspeaks changed the title [css-flexbox-1] Clarify min-content and max-content contributions on the block axis [css-flexbox-1] Clarify min-content and max-content sizing on the block axis Apr 22, 2025
@Loirooriol
Copy link
Contributor

It's defined in https://drafts.csswg.org/css-flexbox-1/#intrinsic-sizes, it should work for both axes.

Anyways, the algorithm is not web compatible and needs to be changed: #8884 (comment)

@gitspeaks
Copy link
Author

It's defined in https://drafts.csswg.org/css-flexbox-1/#intrinsic-sizes, it should work for both axes.

  1. When the block-size is in the cross direction: Section 9.9.2. Flex Container Intrinsic Cross Sizes applies. However, this section does not distinguish between min-content and max-content sizes, contrary to what the comments in my initial message suggest.

  2. When the block-size is in the main direction: Section 9.9.1. Flex Container Intrinsic Main Sizes applies. Specifically, the "ideal algorithm" notes:

    "The min-content main size of a single-line flex container is calculated identically to the max-content main size, except that the flex items’ min-content contributions are used instead of their max-content contributions."

However, it's unclear what the actual difference is—if any—between the max-content and min-content contributions of a flex item when block-size is involved.

  1. Section 9.9.3. Flex Item Intrinsic Size Contributions explicitly refers only to the main size. When the inline size is the main direction and block size is the cross direction, it’s unclear how this section applies to block-size. If the instructions are indeed meant to apply to both axes, then using “main size” is misleading, and the spec should explicitly state that the logic applies to both dimensions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants