Re: [css3-flexbox] Initial value of 'flex' should make flexible boxes

On 04/20/2012 03:52 PM, Tab Atkins Jr. wrote:
> On Fri, Apr 20, 2012 at 3:19 PM, fantasai<fantasai.lists@inkedblade.net>  wrote:
>> Currently the initial value of 'flex' is 'none', which means "use
>> width/height
>> and don't be flexible". Wouldn't it make more sense if it was "use
>> width/height
>> and be flexible", i.e. 'auto'?
>
> No, you want the current defaults, as it makes common cases simpler to
> understand.
>
> Take a simple example, like a two-column layout where the left column
> should be 200px wide and the right column should take the remaining
> space.  If things were flexible by default, you'd have to do:
>
> .container { display:flexbox; }
> .left { width: 200px; flex: 0; }
>
> This seems less intuitive than the current code:
>
> .container { display: flexbox; }
> .left { width: 200px; }
> .right { flex: 1; }
>
> Having to explicitly turn on flexing just seems more natural than
> having to explicitly turn it *off* in some situations.
>
> (In the old world of the flex() function, width:auto computed to
> flex(1).  That was even better - all you had to say was:
>
> .container { display: flexbox; }
> .left { width: 200px; }
>
> ...and you were done. I wish I could have salvaged that approach, but
> alas, it had too many problems.)

Ah, I see. That makes sense. How about if the main size computes to auto,
and flex has its initial value (whatever that winds up being), flex also
computes to auto? That way turning on flexbox would give you flexing by
default, but if you set an explicit width it respects that instead?

~fantasai

Received on Friday, 20 April 2012 23:12:33 UTC