- From: Bert Bos <bert@w3.org>
- Date: Tue, 5 Feb 2008 15:32:54 +0100
- To: www-style Mailing List <www-style@w3.org>
CSS determines the width of boxes in one of two ways: outside-in or
inside-out. The former is for boxes in normal flow: the sum of width
and margins is equal to the width of the containing block, the width of
child boxes doesn't play a role. The latter concerns boxes that
shrink-wrap: the width depends on child boxes, and the containing
block's width only provides a hint in case there are multiple possible
widths.
Of course, as Boris points out, a box in normal flow may have a
containing block that itself is shrink-wrapped, and in that case the
box's children may influence the box's containing block, and thus the
box is *indirectly* influenced by its children. But that is not what is
meant in 10.3.2 (nor anywhere else where the same phrase is used).
The phrase ("if the containing block's width depends on this element's
width") was used instead of an enumeration of cases, because we expect
there will be more cases in CSS3 than in CSS2. In particular, there
will be the case of a block-level box in normal flow that is
nevertheless shrink-wrapped, because it has 'width: fit-content'. (In
practice, though, the sections will be rewritten anyway, because of
those extra values and because of the addition of vertical text.)
But with respect to level 2, the phrase "if the containing block's width
depends on this element's width" refers to containing blocks that are
made from:
- Floating, non-replaced elements
- Absolutely positioned, non-replaced elements
- 'Inline-block', non-replaced elements in normal flow
On Monday 04 February 2008 20:48, fantasai wrote:
> Boris Zbarsky wrote:
> > fantasai wrote:
> >> Ok, so my understanding is that for CSS2.1:10.3.2, we should say
> >> that if a
> >> replaced element has intrinsic percentage width and its containing
> >> block's
> >> width depends on the replaced element's width/height, then "the
> >> resulting layout is undefined in CSS2.1", as it is for specified
> >> percentage widths in the same situation.
> >
> > I guess so, yeah.
>
> Exact replacement:
>
> In Section 10.3.2, last paragraph replace
>
> "If it does, then a percentage intrinsic width on that element
> can't be resolved and the element is assumed to have no intrinsic
> width."
>
> with
>
> "If it does, then the resulting layout is undefined in CSS2.1."
That's fine for CSS 2.1.
We can define it precisely in level 3, I think. The CSS box module
level 3 has text for how to determine the width of shrink-wrapped
boxes. (There are still some paragraphs marked as "to do", but we'll
get there...). That text also handles descendants with percentage
widths.
>
> >> For 10.6.2 we change nothing, except move the paragraph beginning
> >> "Percentage" up to become the second paragraph to clarify its
> >> interaction with the other rules in that section.
> >
> > Yeah, that would make sense.
>
> ~fantasai
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, 5 February 2008 14:33:16 UTC