Skip to content

[css-flexbox-1] "flex" initial value seems to be coontradictory to "flex-grow" and "flex-shrink" #6639

Closed

Description

@pnabbefeld

In §7.1 of the current Editor's draft, "flex-grow" and "flex-shrink" both have an initial value of "1", while in "flex" shorthand the initial value is given as "0 1 auto" - this looks contradictory to me, as in this case the "flex-grow" value is "0". Could You correct or clarify, please?

https://www.w3.org/TR/css-flexbox-1/#flex-property

Activity

  1. myakura commented on Sep 18, 2021

    @myakura
    Contributor

    you can find a note later in that section:

    The initial values of the flex components are equivalent to flex: 0 1 auto.

    Note: The initial values of flex-grow and flex-basis are different from their defaults when omitted in the flex shorthand. This is so that the flex shorthand can better accommodate the most common cases.

    so it's intentional that the value of flex-grow resolves to 0 if you use flex shorthand unless overriding flex-grow.

  2. pnabbefeld commented on Sep 18, 2021

    @pnabbefeld
    Author

    Thank You for Your quick answer! Probably the structure of §7 could be changed to something like §5? IMHO, starting the paragraph with "flex" shorthand, then explaining the different sub properties, and finally coming back to the shorthand is somewhat confusing, especially when having different initial values.

  3. fantasai commented on Aug 18, 2022

    @fantasai
    Collaborator

    @pnabbefeld OK, we shifted the note up towards the top of the section so it's more obvious. :)

    We didn't structure the flex section the same way because in this case we wanted to strongly recommend that authors use the shorthand rather than the longhands. (The longhands were mainly added to facilitate scripting, and because of the way they are defaulted, are more likely to get authors in trouble than using the shorthand.)

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