Re: [css3-flexbox] flex-basis initial value should be 0px

On 05/21/2012 06:29 PM, Tab Atkins Jr. wrote:
> (I'm hoping that this doesn't start a new thread.  For some reason
> Ojan's message hasn't my inbox yet, an hour after it showed up in the
> list archives.)
>
> On May 21 2012, Ojan said:
>> I think this was probably an oversight in the recent changes to the spec,
>> but at some point, the default value of flex-basis changed from 0px to auto.
>>
>> "‘flex:<positive-number>’
>> Equivalent to ‘flex:<positive-number>  1 0px’. This value makes the flex
>> item flexible, and sets the flex basisto zero, resulting in an item that
>> receives the specified proportion of the free space in the flex container.
>> If all items in the flex container use this pattern, their sizes will be
>> proportional to the specified flex ratio."
>>
>> That seems like the correct default behavior. Having auto as the preferred
>> size is considerably slower and often not what the developer wants. It
>> should not be the default value.
>>
>> "flex:auto == flex:1 1 auto" and "flex:none == flex: 0 0 auto" both seem
>> fine to me as is, but the default value for flex should be "1 1 0px".
>
> Before we added flex-grow/shrink/basis, the initial value for 'flex'
> was "none", or "0 0 auto".  I suspect that's why gave flex-basis
> 'auto' as its initial value.
>
> Now, though, everything flexes by default.  I have no real opinion on
> whether "absolute" or "relative" flex is the better default behavior.
>
> Anyone else have strong opinions either way?

Yes, I think the default behavior should be 'auto'. If you're not
specifying proportions explicitly and just want things to auto-fit,
this is the right behavior. Also ignoring width/height by default
seems like a really bad call.

In other words, 'flex: auto' is a better default than 'flex: 1'.

If you're individually tweaking 'flex-grow' and not getting expected
results, it's your fault for not using the shorthand like you're
supposed to!

~fantasai

Received on Tuesday, 22 May 2012 19:01:51 UTC