W3C home > Mailing lists > Public > www-style@w3.org > May 2012

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

From: fantasai <fantasai.lists@inkedblade.net>
Date: Wed, 23 May 2012 14:58:26 -0700
Message-ID: <4FBD5D82.6060001@inkedblade.net>
To: www-style@w3.org
On 05/23/2012 11:23 AM, Tab Atkins Jr. wrote:
> On Wed, May 23, 2012 at 11:04 AM, Tony Chang<tony@chromium.org>  wrote:
>>> Ojan, Tony, when you say that 'flex-basis:0' is cheaper than 'auto',
>>> are you keeping in mind that, by default, flexbox items will have a
>>> min-width/height value of 'min-content'?  I don't know if we
>>> fast-track that for width, but it seems to require at least *some*
>>> layout-level computation.  For column flexboxes, the min-height seems
>>> to require a full layout anyway.
>> Huh, I totally missed section 4.4 about the implied min size.  I see it now
>> in the minutes sent on May 15th.
>> I understand the desire to avoid overflow, but it has the cost of making
>> layout slower by default, even if there's no overflow.  I'm not sure it's
>> worth it.  I would rather authors have to opt-in for slower behavior to
>> avoid overflow by setting min-width to min-content explicitly.  That seems
>> more consistent with how min-width works everywhere except for tables.
>>   Also, I think one of the reasons people don't use table layouts much
>> anymore is because of slow cases like this.
> :/ The problem with making the default behavior bad in corner cases is
> that people generally won't flip switches they don't have to, so when
> the corner case comes up, most people will end up with bad behavior.
> You can definitely opt into the "shut up, I know what I'm doing, 0 min
> size" by setting "min-width: 0;" explicitly.  I generally prefer
> making the default behavior safe-but-slightly-slower and giving people
> the option to flip a "speed it up" switch that's slightly more
> dangerous.

I'm with Tab on this point.

> Note that the grid only gets "messed up" if the screen is small enough
> to make some of the items less than their min-size.  min-size only has
> an effect when an item tries to shrink below it; during normal flexing
> it has no effect.

(Phil or dholbert can correct me if I'm wrong, but IIRC, Grid also honors
min-content sizes in most cases.)

>> The benefit is when trying to use flexbox for site layout (like 3 column),
>> you get fast behavior by default.  Having to compute the min-content size of
>> the main body is going to be slow.
> That's true. :/

I suggest adding a note to that effect. Particularly if the columns are
combined with media queries, setting min-content to a fixed value (especially
a sensible value in ems, rather than zero) should be fine. But if the author
is not considering narrow windows and accommodating correctly (which is by
far the common case), having the min-content limit helps ensure the site is

Received on Thursday, 24 May 2012 04:34:04 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:16 UTC