Skip to content

[css-flexbox] multiple lines when calculating container's max-content main size? #6747

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
davidsgrogan opened this issue Oct 19, 2021 · 4 comments

Comments

@davidsgrogan
Copy link
Member

https://drafts.csswg.org/css-flexbox/#intrinsic-main-sizes says, emphasis mine:

  1. Place all flex items into lines of infinite length.
  2. Within each line, find the largest max-content flex fraction among all the flex items...
  3. The flex container’s max-content size is the largest sum of the afore-calculated sizes of all items within a single line.

Question: if the lines are of infinite length, how could there be more than one line?

@astearns
Copy link
Member

My first thought was that it might be due to an interaction with break-before or break-after in multi-line flex containers. But “The exact layout of a fragmented flex container is not defined in this level of Flexible Box Layout” so it may be more of a future thing and only in paginated contexts.

This pen shows Firefox honoring break-before: page in a non-paginated context, which I am not sure it is supposed to be doing: https://codepen.io/astearns/pen/QWMEBdY

@Loirooriol
Copy link
Contributor

Firefox honoring break-before: page in a non-paginated context, which I am not sure it is supposed to be doing

My understanding is that an old version of the spec seemed to say this should happen, but that's no longer the case.

However, there is wrap-before/after: flex:

Force a flex line break immediately before/after the box if the box is a flex item in a multi-line flex container.

@astearns
Copy link
Member

Ah, thanks! It looks like that’s not implemented anywhere, but it would be the reason for that step.

https://codepen.io/astearns/pen/JjyRXZg

@davidsgrogan
Copy link
Member Author

Ah, great. Thanks for the info. Closing this issue now.

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

3 participants