Skip to content

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

Closed

Description

@cbiesinger

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

Activity

  1. Loirooriol commented on Sep 16, 2019

    @Loirooriol
    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

  2. davidsgrogan commented on Sep 16, 2019

    @davidsgrogan
    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?

  3. Loirooriol commented on Sep 16, 2019

    @Loirooriol
    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"

  4. cbiesinger commented on Jan 23, 2020

    @cbiesinger
    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions