Re: REC-CSS2 contradicts itself on "containing blocks"

On Wed, 18 Aug 1999, Gilbert Baumann wrote:
> There are two contradiction in REC-CSS2-19980512.

Interesting. In all the time I've spent writing tests to get this to
work in Mozilla, I never noticed these contradictions. No one else seems
to have mentioned them either.

The answers I give below are not the 'official' ones, but the ones that I
believe are generally considered as being what is meant, and the ones that
the many dozens of test pages use, and the ones that Mozilla is
implementing. They are self-consistent and appear (from other parts of the
spec) to be correct.

(I hope so, anyway. If I have made any errors I am sure someone will be
quick to correct me.)


> Quote i: section 8.1 (Box dimensions) says
> 
> | padding edge
> |      [...] The padding edge of a box defines the edges of the
> |      containing block established by the box.

This definition and the content edge one should read:

: content edge or inner edge
:      The content edge surrounds the element's rendered content and
:      defines the edges of the containing block established by the box
:      as used by children who are in the normal flow.
: padding edge
:      The padding edge surrounds the box padding. If the padding has
:      0 width, the padding edge is the same as the content edge. The
:      padding edge of a box defines the edges of the containing block
:      used by absolutely positioned child elements.


> Quote ii: section 9.4.3 (Relative positioning), second paragraph:
> 
> |  A relatively positioned box establishes a new a new containing
> |  block for normal flow children and positioned descendants.

This should read "A relatively positioned box establishes a new
containing block for absolutely positioned descendants. (A relatively
positioned _block_ box also establishes a new containing block for normal
flow children, of course - see section 10.1.2.)".

 
> Quote iii: 10.1 (Definition of "containing block"), item 2 says: 
> 
> |   2. For other elements, unless the element is absolutely positioned, the
> |      containing block is formed by the content edge of the nearest
> |      block-level ancestor box.

This is correct.

 
> The first question is: What are the edges of a vanilla containing
> block?  The padding edges (quote i) or the content edges (quote iii).

Content edge, otherwise percentage values on 'width' would not be relative
to the 'width' of the parent box.


> The second question is: Suppose this input:
> 
>     EM { position: relative; }
>     
>     <P>
>       <EM>foo <B>bar</B> baz</EM>
> 
> What is the containg block of the B element? The box(en) created by EM
> (quote ii) or the box created by P (quote iii)? (after all EM is an
> inline element).

The box created by P. The containing block established by the EM box only
applies to absolutely positioned elements.

-- 
Ian Hickson
: Is your JavaScript ready for Nav5 and IE5?
: Get the latest JavaScript client sniffer at 
: http://developer.netscape.com/docs/examples/javascript/browser_type.html

Received on Saturday, 28 August 1999 10:51:07 UTC