W3C home > Mailing lists > Public > www-style@w3.org > September 2009

Re: [CSS21] display:run-in clarifications

From: Bert Bos <bert@w3.org>
Date: Tue, 1 Sep 2009 18:13:12 +0200
To: www-style@w3.org
Message-Id: <200909011813.12866.bert@w3.org>
On Tuesday 01 September 2009, Boris Zbarsky wrote:
> Boris Zbarsky wrote:
> > Makes the [1] reference a little confusing, but other than that,
> > looks good.
>
> I was making notes to myself on implementing this stuff, and found
> another possible ambiguity.  If an element with display:run-in has an
> absolutely positioned or floated child, and gets run in, what is the
> right containing block for the child?  Is it the nearest block parent
> the run-in used to have?  Or the block the run-in ran into?

That is a separate issue from how the run-in element itself is 
displayed, but it indeed needs to be defined somewhere. The place where 
this belongs is probably 10.1 and I think one can argue that it is 
already defined:

If the child is floating, item 2 applies, which says: "[...] the 
containing block is formed by the content edge of the nearest 
block-level, table cell or inline-block ancestor box."

The term "block-level" is a link to its definition, which says: "Several 
values of the 'display' property make an element  
block-level: 'block', 'list-item', and 'run-in' (part of the time; see 
run-in boxes), and 'table'."

Although the text doesn't say so explicitly, it seems reasonable to 
assume that "part of the time" refers to the cases where the 'run-in' 
is displayed as a block and not to the cases where the run-in is 
displayed inline. In other words, an element that is displayed run-in 
is *not* the containing block for its floating child. The containing 
block must instead be found among the ancestors of the run-in element.

If the child is absolutely positioned, the definition is more direct. 
Item 4 in 10.1 applies and it says to look for an ancestor with a 
certain 'position' property and then defines the containing block both 
for inline ancestors and others.


Is it better that the containing block of a floating child is formed by 
the block after the run-in, or by that block's parent? I interpret 10.1 
as using the latter. There is a difference, of course, but is it an 
important difference? It has an influence on how much left/right margin 
a designer must give the float.


>
> Testcase:
>
> <!DOCTYPE html>
> <html>
> <body>
>    <div style="padding: 100px; border: 1px solid green; position:
> relative"> <span style="display:run-in; border: 1px solid red">
>        <div style="position: absolute; top: 0; left: 0">aaa</div>
>        bbb
>        <div style="float: left">ccc</div>
>      </span>
>      <div style="position: relative; border: 1px solid black">
>      </div>
>    </div>
> </body>
> </html>
>
> In Opera and IE8, the run-in just doesn't run in, as I recall.  I
> can't make sense of what webkit is doing; all the text except "aaa"
> disappears here.
>
> It would make the most sense to me to use the block the run-in ran
> into as the containing block.
>
> Is this already covered by the spec text in some way, or do we need
> to make it explicit?



Bert
-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos                               W3C/ERCIM
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France
Received on Tuesday, 1 September 2009 16:13:50 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:20 GMT