Re: [flex-units] unit abbreviations and the flex()

On May 27, 2010, at 10:39 PM, Zack Weinberg wrote:

> Brad Kemper <brad.kemper@gmail.com> wrote:
>> On May 27, 2010, at 5:39 PM, Zack Weinberg <zweinberg@mozilla.com>  
>> wrote:
>> 
>>>> I disagree, because it is only when the space in the
>>>> width of the container is too constrained that all the flex widths
>>>> all get narrower than their intrinsic or set widths.
>>> 
>>> That the confusing behavior only happens under rare circumstances
>>> does not excuse the confusing behavior.
>> 
>> It's not confusing if you expect it and count on it because it is  
>> sometimes what you want. There Is always 'min-width' for the other  
>> times. 
> 
> This is on a different level.  I am saying that calc(10px + 1fl) 
> *reads as if* it cannot be narrower than 10px, and therefore Tab's
> proposed semantics are confusing. You are saying that sometimes you 
> want it to be narrower than 10px, but to that I say, why not write 
> calc(10px + 1fl - upto(10px)) if that's what you mean?

Because that is a worse and more confusing syntax. It seems like you are just adding notation for no good reason. 

'calc(10px + 1fl)' is not confusing to me at all, because I know that flex can be negative, and that adding a negative number makes something smaller. I don't see anything there that implies that 1fl must be 0 or more. The idea of flexbox is to end up with items that are proportioned the way the author asks, with whatever space is available. So if there is not enough space available without overflowing, then the space to apportion is a negative number, and flex takes away instead of giving. If you wanted to prevent something from going narrower than a certain size, then that is exactly what 'min-width' already exists for.

Consider the case where flex is being added to intrinsic widths, which I believe is more or less the only thing to do in the pre-Tab version. This is more or less like saying the following for the items in the flexbox:

A { width:calc(1fl + fit-content); } 
B { width:calc(2fl + fit-content); } 

In that situation, I expect any leftover space in the flexbox to be distributed to the width of the two boxes (if they are the only two). If the intrinsic widths of A+B is less than the width of the flexbox, then I expect "B" to be twice as wide as "A". If "A" is filled with lots of small text, then it could wrap. If "B" is a single very large letter, then the "B" might have some overflow. If I didn't want that, and wanted the flexbox to overflow, then I would put min-widths on A and B:

A, B { min-width:fit-content; }

That all seems pretty clear. And '- upto(fit-content)' or '- upto(10px)' just seems like a more complicated and unusual way to avoid adding a negative number. There is nothing at all unusual about adding negative numbers.

Received on Friday, 28 May 2010 06:28:17 UTC