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

On Tue, May 22, 2012 at 12:00 PM, fantasai <fantasai.lists@inkedblade.net>wrote:

> On 05/21/2012 06:29 PM, Tab Atkins Jr. wrote:
>
>> 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.
>

I'm not able to come up with that many use cases where you would want auto.
 For example, in a toolbar or menu, I would think you want all the buttons
to be equally sized.  Using auto, you're not going to get that behavior
unless your buttons are already equally sized.  Or if you want to do
something like a 3 column layout (e.g., a flex ratio of 1-3-1), you would
want the flex basis to be 0.  Can you provide some use cases where you
would want a flex basis of auto?

Auto sizing is very hard to predict the size of a flex item.  In practice,
I think auto is only useful in a guess and check style of development where
you try different flex basis values and see what looks good.


> 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 22:00:33 UTC