Skip to content

[css-flexbox] Clarify whether unresolvable percentages prevent stretching? #4312

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
cbiesinger opened this issue Sep 16, 2019 · 4 comments
Closed
Labels
Closed Accepted by CSSWG Resolution Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. css-flexbox-1 Current Work

Comments

@cbiesinger
Copy link

https://drafts.csswg.org/css-flexbox/#valdef-align-items-stretch

If the cross size property of the flex item computes to auto, and neither of the cross-axis margins are auto, the flex item is stretched

Combined with:
https://drafts.csswg.org/css2/visudet.html#the-height-property

the height of the containing block is not specified explicitly (i.e., it depends on content height), and this element is not absolutely positioned, the value computes to 'auto'.

So I just wanted to verify that the item should still stretch in a case like this:

<div style="display: flex;">
  <div style="height: 100%; background: green"></div>
  <div style="height: 200px;"></div>
<div>

Note that neither Chrome nor Firefox currently stretch the item.

@dholbert @fantasai @tabatkins @davidsgrogan

@cbiesinger cbiesinger added the css-flexbox-1 Current Work label Sep 16, 2019
@Loirooriol
Copy link
Contributor

An indefinite percentage only behaves as auto, but doesn't actually compute to auto. That's just legacy prose from css2. See https://drafts.csswg.org/css-sizing-3/#behave-auto

@davidsgrogan
Copy link
Member

The Note in https://drafts.csswg.org/css-sizing-3/#behave-auto says

Note: Legacy spec prose defining layout behavior might explicitly refer to width/height having a computed value of auto as a condition; these should be interpreted as meaning behaves as auto, and reported to the CSSWG for updating.

Does that mean that https://drafts.csswg.org/css-flexbox/#valdef-align-items-stretch should change from

If the cross size property of the flex item computes to auto, and neither of the cross-axis margins are auto, the flex item is stretched

to

If the cross size property of the flex item behaves as auto, and neither of the cross-axis margins are auto, the flex item is stretched

Which would bring us back to the original question?

@Loirooriol
Copy link
Contributor

I believe the flexbox prose is not legacy so it really means "computes to auto".

For example https://drafts.csswg.org/css-flexbox/#min-size-auto uses the new terminology: "percentages calculated against this size will behave as auto"

@cbiesinger
Copy link
Author

Per #4525 indefinite percentages do not count as auto and thus should not stretch the item.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closed Accepted by CSSWG Resolution Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. css-flexbox-1 Current Work
Projects
None yet
Development

No branches or pull requests

4 participants