effects of "float" on a table-component in a flex container? from Daniel Holbert on 2012-10-23 (www-style@w3.org from October 2012) (original) (raw)

Hi www-style,

I think I've found a paradox in the spec which needs some clarification.

Basically, the problem is with how the following line interacts with table-fixup:

�float� and �clear� have no effect on a flex item.

Source: http://dev.w3.org/csswg/css3-flexbox/#flex-containers

So -- let's start with a simple situation, with no floating:

cell
To render that, we do table-fixup to generate an anonymous table-box. The element is definitely not a flex item -- its anonymous table-ancestor is. Agreed? Cool.

NOW: Suppose we add style="float: left" to the element. What happens then?

The flexbox spec's "float has no effect" doesn't seem to apply, because the element isn't a flex item. So presumably we should apply the rules for floats from CSS 2.1 section 9.7: convert the 's display value to "block" and float the element (in what containing block...?) BUT that causes problems: (a) now our td is display:block, so it is a flex item. So now, the "float has no effect" rule suddenly is applicable. So maybe our float-triggered display:block conversion should be reverted, to honor that? (But then it would no longer be a flex item, and float would have an effect again... and around and around we go)

(b) now we don't need the anonymous table wrapper anymore, so should we still create it?

Among other things, the problem is that we can't easily implement "float has no effect on flex items" because float's effect on computed style happens before decided what is & isn't a flex item.

POSSIBLE RESOLUTION: I believe an earlier version of the spec said something like:

float has no effect on a child of a flex container

except to change their "display" value.

If we switched back to that sort of language, then the problems I'm bringing up would be resolved. In particular -- if the spec said "child" instead of "flex item" here, that'd prevent the circular dependency / paradox of " is not a flex item, so float applies and makes it a block, which makes it a flex item, which means float doesn't apply". And the explicit mention of float's display-value conversion would remove any ambiguity about whether a floated child still triggers table-fixup. (I don't think it should.)

Thanks, ~Daniel

Received on Tuesday, 23 October 2012 19:34:38 UTC