Re: [css3-flexbox] remove flex() function

On Mon, Nov 28, 2011 at 7:14 PM, Alex Mogilevsky <alexmog@microsoft.com> wrote:
> I would like to reconsider using flex() function to specify flexibility.
>
> When flex() was introduced to the spec, it was because
>
>   1) flex() was intended to be used on more properties (margins,
>      padding). Adding separate properties for
>      each flexible length would be excessive then.
>   2) flex(<flexibility> <preferred-size>) was expected to be more
>      intuitive than separately setting preferred
>      size. In particular "flex(1)" is supposed to read
>      better than "width:0; flex:1;"
>
> In current state of the spec however, (1) no longer applies and (2) doesn't seem a good reason to do things differently from elsewhere in CSS.

I disagree in the strongest terms.  (2) is not "expected to be more
intuitive".  We *know*, with tons of examples (including our own
chair!) that authors find it confusing if width/height and flexibility
are separate properties.  Combining them removes the possibility for
confusion.  We've had this discussion before, and I don't really want
to rehash it.  There are benefits to separating them, but they're
massively outweighed by the well-established author confusion from
doing so.

[snip list of issues]

I agree that flex() has some less-than-ideal properties.  In
particular, I'm not wild about it being usable outside of flexboxes,
and I don't like that it has to be specified as a physical dimension
when it only applies to the flexbox's main size, which maps to a
physical dimension based on other properties.

We can possibly fix this in other ways, if it's really desirable.  For
example, we could have a 'flex' property that takes the same syntax as
the flex() function and which applies *instead of* width/height
(whichever is appropriate).  This would solve both of the problems I
complained about above, and a few more of your issues.  It could also
be turned into a shorthand later (or now), allowing independent
cascading of the different pieces.

~TJ

Received on Tuesday, 29 November 2011 19:42:27 UTC