W3C home > Mailing lists > Public > www-style@w3.org > October 2010

Re: [CSS 2.1][Section 10.3.7] Calculating width and margin-left for abs. pos. with max-width constraint

From: Gérard Talbot <www-style@gtalbot.org>
Date: Mon, 11 Oct 2010 14:39:35 -0700
Message-ID: <36d60c5ab475a8fbc2617d1727626297.squirrel@cp3.shieldhost.com>
To: "Boris Zbarsky" <bzbarsky@MIT.EDU>
Cc: "www-style list" <www-style@w3.org>

Le Lun 11 octobre 2010 8:30, Boris Zbarsky a écrit :
> On 10/11/10 12:33 AM, "Gérard Talbot" wrote:
>> http://www.gtalbot.org/BrowserBugsSection/css21testsuite/absolute-non-replaced-width-025.htm
>> http://www.gtalbot.org/BrowserBugsSection/css21testsuite/absolute-non-replaced-width-026.htm
> ...
>> 1- Are those 2 testcases correct?
> Yes, if the window is sufficiently wide

For the testcases, I always assume a minimum of 640px of viewport width.

> and if the body padding is 8px
> in the UA.

Body padding must be 8px? Are you sure? Both testcases had body {margin:
8px;} which is the default in browsers.

> For the first one, section 10.3.7 means that width is
> computed, and if it computes to more than 100px then the rules are
> applied _again_ assuming a computed width of 100px.  Then all three of
> width/left/right are non-auto, both margins are auto, so the margins get
> equal values.

Ok, great! This is what I was missing.

> For the second one, the same reasoning applies, but now only one margin
> is auto, so it's solved for directly.
> I'd suggest making the body position:relative and setting left/right to
> 0 throughout so as to avoid the "if the window is sufficiently wide and
> if the body padding is 8px in the UA" assumptions.

The CSS 2.1 test suite testcases require a viewport width minimum of 640px.

Boris, I do not understand where does that 8px body padding comes from..

>> 3- One issue that puzzles me is that the spec [1] says to
>> {
>> set 'auto' values for 'margin-left' and 'margin-right' to 0, and [if]
>> (...) 5. 'width' is 'auto', 'left' and 'right' are not 'auto', then
>> solve
>> for 'width'."
>> }
>> a) is setting the 'margin-left: auto' to 0 and 'margin-right: auto' to 0
>> permanent or done only for the purposes of calculating width?
> What's being set to 0 is the used value of margin-left and margin-right.
>   Then the used value of width is computed.
> If the result gives width > max-width, all values are reset back to
> their computed values, computed width is set to 100px, and the
> computation in 10.3.7 is redone.  I agree that the spec could be clearer
> on this....
> -Boris

regards, Gérard
CSS 2.1 Test suite RC2 (October 1st 2010)

Contributions to CSS 2.1 test suite

Web authors' contributions to CSS 2.1 test suite
Received on Monday, 11 October 2010 21:40:15 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 11 February 2015 12:34:43 UTC