Re: CSS 2.1 - 10.3.3 - Block-level, non-replaced elements in normal flow

Rossen Atanassov wrote:
> <div style=”width:0px;”>
>     <div style=”margin:10px;”>text</div>  <- - This is the block-level 
> element I want to apply these rules to.
> </div>
> 1.        First statement does not apply since the width is ‘auto’ (from 
> its initial value)


> 2.       Second statement does not apply for the very same reason


> 3.       Third rule does apply since we have exactly one value of 
> ‘auto’, namely the width. So the spec suggests that value follows from 
> the equality above, which would make the used width to be negative value 
> (-20px).

You're ignoring the effect of min-width.  Since the computed value of min-width 
is always non-negative, the list in section section 10.4 applies:

    1. The tentative used width is calculated (without 'min-width' and
       'max-width') following the rules under "Calculating widths and margins"

This gives "-20px" for the tentative used value.

    2. If the tentative used width is greater than 'max-width', the
       rules above are applied again, but this time using the computed
       value of 'max-width' as the computed value for 'width'.

This has no effect.

    3. If the resulting width is smaller than 'min-width', the rules
       above are applied again, but this time using the value of
       'min-width' as the computed value for 'width'.

This reapplies section 10.3.3 with a computed value of 0 for the width.  At that 
point, the third rule in 10.3.3 no longer applies.  More importantly, the first 
rule applies: the situation is over-constrained, so the margin-right value ends 
up as -10px.

I think that covers your first question.

> However, section CSS2.1 – 10.2 Content width: the ‘width’ property, 
> states that “Negative values for ‘width’ are illegal.”

That has to do with the specified value.  That is, having a declaration like:

   width: -100px;

is illegal, and the declaration should be discarded by the parser.

> 2.       What about other properties such as padding-left|right and 
> border-left|right, are these allowed to become negative following these 
> rules?

Since those can never have auto computed values, I don't see how they could 
"become" anything.  The only values that can be "auto" by the time 10.3.3 is 
being applied are width, margin-left, and margin-right.


Received on Tuesday, 6 November 2007 18:20:02 UTC