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

[css3-flexbox] splitting inline children around blocks, inside a flexbox

From: Daniel Holbert <dholbert@mozilla.com>
Date: Thu, 22 Mar 2012 11:04:45 -0700
Message-ID: <4F6B69BD.7080006@mozilla.com>
To: www-style list <www-style@w3.org>
Hi www-style,

I believe the flexbox spec is currently inconsistent / unclear on handling
of situations with a block inside an inline, like "anonymous item 7.1" in
Example 2.

That example looks like this:
  <div style="display:flexbox">
    <span id="item7.1">
      text 7.2
      <div id="not-an-item7.3">block</div>
        text 7.4

The prose at the bottom of the example say that not-an-item7.3 doesn't
form its own flexbox item, because it's contained inside an inline
element.  (technically, the prose says not-an-item6.3 right now, but
that's a typo, which I emailed about separately)

However -- I think that prose disagrees with the normative spec text about
what makes a flexbox item: "boxes that satisfy one of the following
criteria... 1. Immediate block-level children of flexbox")[1].

Note that the normative text refers to _boxes_ there, not _elements_.  And
in the example above, the _box_ for "not-an-item7.3" IS an immediate child
of the flexbox, even if its element is not.

This is according to the inline/block interaction rules in CSS 2.1 section [2]:
"When an inline box contains an in-flow block-level box, the inline box
...[is] broken around the block-level box... The line boxes before the
break and after the break are enclosed in anonymous block boxes, and the
block-level box becomes a sibling of those anonymous boxes

In other words: if we follow CSS2.1 on how blocks behave inside of an
inline, then the box for "not-an-item7.3" becomes an immediate child of
the flexbox, which means the Flexbox spec says it should get its own
flexbox item, contrary to what the example says.

I think this needs clarification in the flexbox spec.  Maybe we need to
use the element hierarchy instead of the box hierarchy for determining
flexbox item eligibility?  I'm not sure if that makes sense.


[1] http://dev.w3.org/csswg/css3-flexbox/#flex-items
[2] http://www.w3.org/TR/CSS21/visuren.html#anonymous-block-level
Received on Thursday, 22 March 2012 18:05:15 UTC

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