Skip to content

[css-flexbox] How to determine the main/block size of a column flex container? #4905

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

Closed
SimonSapin opened this issue Mar 27, 2020 · 3 comments

Comments

@SimonSapin
Copy link
Contributor

A somewhat early step of the Flex Layout Algorithm is: https://drafts.csswg.org/css-flexbox/#algo-main-container

Determine the main size of the flex container using the rules of the formatting context in which it participates. For this computation, auto margins on flex items are treated as 0.

Let’s say that that we have a column flex container in horizontal writing mode (so the main size is the block size which is the height) with height: auto.

Let’s also that that it is block-level, so the relevant definition is: https://drafts.csswg.org/css2/visudet.html#normal-block

The element's height is the distance from its top content edge to the first applicable of the following: […]

This definition for the height of block-level boxes relies on the content being fully laid out, which is not the case this early in the Flex Layout Algorithm.

Am I missing something or is this under-specified? Should there be something that specifies that height: auto resolves to height: max-content in that case, "redirecting" to the rules in https://drafts.csswg.org/css-flexbox/#intrinsic-sizes?

@fantasai
Copy link
Collaborator

We added a note defining that the automatic block size of a block-level flex container is its max-content size... technically that definition doesn't belong here, but in the spec defining block layout.

Filed #5197 as a follow-up on CSS2 to at least get it to not conflict even if it's not possible to make it quite as tight a connection as we would in a CSS3+ spec.

Let us know if this works for you. @SimonSapin

@SimonSapin
Copy link
Contributor Author

"automatic block size" has link markup in 84dabef (presumably intended to link to https://drafts.csswg.org/css-sizing/#automatic-size, which I just learned is a formal concept we have) but it is not a link in in https://drafts.csswg.org/css-flexbox/#algo-main-container.

Shouldn’t the first new sentence be normative rather than in a note?

The new text says "The Block Layout spec should define this equivalency" but should it really? If it’s specifically about flex containers.

@fantasai
Copy link
Collaborator

fantasai commented Jun 9, 2021

Shouldn’t the first new sentence be normative rather than in a note? The new text says "The Block Layout spec should define this equivalency" but should it really?

No, it's Block Layout that decided that every box should use its max-content block size. Items in Flex Layout and Grid Layout, for example, don't use their max-content block size by default. (This should be normatively defined somewhere, but since it really doesn't belong in this spec we're leaving it as a note.)

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

No branches or pull requests

2 participants