This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 21847 - The ‘flex’ Shorthand: Grow shorthand
Summary: The ‘flex’ Shorthand: Grow shorthand
Status: RESOLVED INVALID
Alias: None
Product: CSS
Classification: Unclassified
Component: Flexbox (show other bugs)
Version: unspecified
Hardware: PC All
: P2 minor
Target Milestone: ---
Assignee: Tab Atkins Jr.
QA Contact: public-css-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-26 10:51 UTC by Craig Francis
Modified: 2013-04-26 19:24 UTC (History)
2 users (show)

See Also:


Attachments

Description Craig Francis 2013-04-26 10:51:19 UTC
In section 7.1, The ‘flex’ Shorthand:

http://www.w3.org/TR/css3-flexbox/#flex-property

The flex-grow description ends with "When omitted, it is set to ‘1’"

However the default for flex-grow is 0:

http://www.w3.org/TR/css3-flexbox/#flex-grow

It seems like a copy/paste issue from flex-shrink which does have a default of 1.
Comment 1 Tab Atkins Jr. 2013-04-26 14:52:13 UTC
Nope, that's the intended behavior.  The initial values are set up to give us the default behavior of "0 1 auto", but they're not the best values for when you actually start using the shorthand.  So, we substitute missing values specially, rather than relying on the normal "use the initial value" behavior.
Comment 2 Craig Francis 2013-04-26 15:08:08 UTC
Odd, thats not how I've used CSS shorthand properties before...

---

http://www.w3.org/TR/CSS21/fonts.html#propdef-font

Because the 'font' shorthand property resets any property not explicitly given a value to its /initial/ value.

---

http://www.w3.org/TR/CSS21/box.html#propdef-border-left

Omitted values are set to their /initial/ values.

---

http://www.w3.org/TR/CSS21/colors.html#propdef-background

Given a valid declaration, the 'background' property first sets all the individual background properties to their /initial/ values, then assigns explicit values given in the declaration.

---

Those are the first three that come to mind, and all use the initial value... so for consistency the flex shorthand should do as well.
Comment 3 Tab Atkins Jr. 2013-04-26 16:39:17 UTC
Yes, like I said, it's different from normal shorthand behavior, and intentional.  It's because there's a mismatch between what we want as the "initial" value, and what we want as the "default" values when omitted.  In most properties, the two concepts are the same.
Comment 4 Craig Francis 2013-04-26 17:37:54 UTC
Not sure I like that, I was experimenting with the flexbox approach today and tried to use the spec to understand what was happening... I initially misread it as the "grow" property should have been set to 1 by default.

Will leave it as resolved, as I presume this has already been implemented in the browsers.

Maybe the document should say:

   When omitted, it is set to '1', although the default is '0'.
Comment 5 Tab Atkins Jr. 2013-04-26 19:24:51 UTC
(In reply to comment #4)
> Maybe the document should say:
> 
>    When omitted, it is set to '1', although the default is '0'.

There is already a note to that effect at the end of section 7.1.