W3C home > Mailing lists > Public > www-style@w3.org > June 2002

Re: block box inside inline box ?

From: Coises <Randy@coises.com>
Date: Wed, 12 Jun 2002 17:04:56 -0700
To: www-style@w3.org
Message-ID: <7lhfgukckpfaqff3f0i5rkcaq9rbh6lbj1@4ax.com>

[Wed, 12 Jun 2002 14:24:37 -0700] Etan Wexler:
>Let us rename the example elements for clarity and add some text:
>
><inline>
>    Outside paragraph
>    <block>
>        Inside paragraph
>        </block>
>    Outside again
></inline>
>
>And I add some rule sets in case anybody is still confused:
>
>inline { display: inline }
>block { display: block }
>
>When I think about this example, I imagine anonymous boxes filling all the roles that 
>help me to visualize the layout.  I will note the anonymous boxes in pseudo-XML 
>examples with the reserved name indicator: "#".
>
>First I need an anonymous block box to contain everything:
>
><#anonymous-block>
>    <inline>
>        Outside paragraph
>        <block>
>            Inside paragraph
>            </block>
>        Outside again
>        </inline>
>    </#anonymous-block>
>
>Then I partition the inline element where it must break into separate boxes:
>
><#anonymous-block>
>    <inline>
>        Outside paragraph
>        </inline>
>    <block>
>        Inside paragraph
>        </block>
>    <inline>
>        Outside again
>        </inline>
>    </#anonymous-block>

This cannot be correct.  The <block> element is no longer a descendant of
the <inline> element... in fact, the <inline> element has been made into
two elements.  Etan did note at the end of the post that this part of the
example is "deceptive."  I suggest that it's not so much "deceptive" as
"wrong."  I see nothing in the standard that supports this reconstruction.

The problem, it seems, is that while this section of the CSS2 standard:
     http://www.w3.org/TR/REC-CSS2/visuren.html#anonymous-block-level
tells us:
     [I]f a block box [...] has another block box inside it [...],
     then we force it to have only block boxes inside it, by wrapping
     any inline boxes in an anonymous block box.
there appears to be no corresponding section that explains what happens
when an inline element contains a block box --- though as far as I can
tell, that is not explicitly forbidden, either.


Intuitively, I would expect this:

1. The <block> content must be formatted as a block.  In the absence of a
"width" property or (for a replaced element) an intrinsic width, it would
fill the width of containing block (which I presume would be the width of
the content area of the <#anonymous-block>).

2. This rectangular <block> element would be placed within a line box in
the same way as any other indivisible element (like a word or an IMG).


Note that the "sample style sheet for HTML 4.0" given here:
     http://www.w3.org/TR/REC-CSS2/sample.html
defines:
     OBJECT {display: block}
and the above is how OBJECT appears to behave when used within an inline
element... if the OBJECT element is actually replaced.  However, something
much different seems to happen when the *content* of the OBJECT element is
rendered (i.e., when the OBJECT's DATA cannot be displayed).


Not being too familiar with X[HT]ML, I had attempted to construct an HTML
example using an OBJECT element (with unrenderable data) to encase block
content:
     http://www.coises.com/operabug/block1.htm
but neither IE 6 nor Opera 6 (the only browsers I have installed here) does
at all what I'd have expected.

It looks as if IE ignores all properties on the unrendered OBJECT, as if it
weren't there at all.  Opera appears to recognize the values of inherited
properties (note the font and color) and pass them along to descendent
elements; but neither browser seems to generate a box for, nor apply any
properties to, the unrenderable OBJECT element itself.
-- 
Randall Joseph Fellmy aka Randy@Coises.com
Received on Wednesday, 12 June 2002 20:03:35 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:14 GMT