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

Re: [css3-flexbox] computing "float" and "clear" on children of a flexbox

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 25 Jan 2012 10:50:33 -0800
Message-ID: <CAAWBYDDLT+rLWAd1fDBonC5Vxp+fLDZc+NhRWOH5ZteAFVJOUA@mail.gmail.com>
To: Daniel Holbert <dholbert@mozilla.com>
Cc: "www-style@w3.org list" <www-style@w3.org>, Alex Mogilevsky <alexmog@microsoft.com>
On Wed, Jan 25, 2012 at 12:20 AM, Daniel Holbert <dholbert@mozilla.com> wrote:
> On 01/24/2012 08:38 PM, Alex Mogilevsky wrote:
>> There is a little bit of a chicken+egg problem here when 'float' is set on
>> inline element:
>>        1) 'float' makes the element block-level
>>        2) flexbox accepts the element as a flex item (because it is block
>> level) rather than wrapping it
>>        3) flexbox layout ignores 'float'
>> That's how it works in IE.
> I'm not 100% sold on this... So for a <span> or an <i> element whose parent
> is a flexbox, the style "float:left" would be functionally identical to
> "display:block", as far as the rendering is concerned?
> If that's how it's supposed to work, it'd be useful if that process & logic
> were spelled out more clearly in the spec.
> My understood was more like "the flexbox itself doesn't establish a context
> for things to float in", and so the span would get wrapped in an anonymous
> block (along with any other contiguous inline non-atomic content
> (disregarding floats' effects on inline-ness)), and then floated to the left
> of the anonymous block.
> I could easily be misunderstanding, though. :)

I'm torn on this.  Right now, Flexbox determines whether to wrap or
not *before* block-in-inline splitting, but *after* table-fixup.  I'm
not certain if we should extract general principles from this or not.

I suppose we can go with the fact that table-fixup is required to
avoid exposing table-internal elements (which are neither block-level
nor inline-level, I guess?), but block-in-inline fixup isn't.  By this
principle, the fact that floats change the computed value of 'display'
should be taken into account only *after* item wrapping.

On the other hand, the item-wrapping algorithm needs to inspect the
value for 'display', and it's most consistent to say that this happens
at computed-value time.  The computed value of 'display', though, is
dependent on 'float', which means that a floated <span> should become
a block and be a proper flexbox item.

I think I like the second interpretation, as it's based on more stable
and widespread rules that should probably continue to work if we
introduce more things like floats, while the first interpretation is
based more on rules-of-thumb that will need manual attention whenever
something new in this class occurs.

Received on Wednesday, 25 January 2012 18:51:20 UTC

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