W3C home > Mailing lists > Public > www-style@w3.org > January 2011

Re: [css3-flexbox] intuitivity and width computation rules

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 12 Jan 2011 12:42:53 -0800
Message-ID: <AANLkTik6n-74eOjPO0EqqrXcPyMnx36ArG433W96i3uy@mail.gmail.com>
To: Rob Crowther <robertc@boogdesign.com>
Cc: www-style list <www-style@w3.org>
On Wed, Jan 12, 2011 at 11:28 AM, Rob Crowther <robertc@boogdesign.com> wrote:
> Tab Atkins Jr. wrote:
>> If you want elements to absorb space based *purely* on their flex, the
>> solution is to set width:0.  The 'width' property sets the preferred
>> width, which is used as the base atop which free space is assigned.
> Just checking:  Is this the solution that will work when the spec has been
> implemented, or is this expected to work in Firefox 4 now?  I find if I set
> width to zero the flexbox stops taking up the available width.

The former.  I'm writing the editor's draft now that will have that behavior.

On Wed, Jan 12, 2011 at 11:37 AM, Sylvain Galineau
<sylvaing@microsoft.com> wrote:
> Setting width:0 does the trick; that it's not obvious is one thing. But if authors
> had to explicitly set width:0 every time they make an element flexible then something
> is wrong; could width:auto resolve to 0 if the element is  flexible ?

Maybe.  Is that the most useful behavior?  Is it more useful to have
'auto' resolve to 'min-content'?  Is it most useful to have 'auto'
resolve to 'max-content' by default (as it does now) and just require
authors to set something other than 'auto' when they have content-full

This can't be solved theoretically, as it's purely a matter of what's
the most useful, given the use-cases we expect.  Note that this is
only a problem for horizontal flexboxes containing horizontal text or
vertical flexboxes containing vertical text.

For example, one use-case for horizontal flexboxes is implementing a
flexible navbar, like in my old company's site at
<http://igofigure.com/>.  In something like this, it seems to be
usually best to flex with a preferred width of fit-content, so that
each entry has the same amount of space around it.  Using min-content
wouldn't be quite right, because the entries with two words wouldn't
take up enough space.

But fit-content doesn't work for Daniel's use-case, because it acts
similarly to max-content.

Like I said, I've already given this some thought, and I believe the
best answer is to have 'auto' resolve to 'min-content'.  That's closer
to the ideal solution for navbars (and authors can adjust it
themselves if they need more precision), and it gives better results
for Daniel's use-case.

Received on Wednesday, 12 January 2011 20:43:46 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:42 UTC