W3C home > Mailing lists > Public > www-style@w3.org > March 2013

Re: [cssom] Interaction of getComputedStyle.width/height and box-sizing

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 29 Mar 2013 10:32:54 -0700
Message-ID: <CAAWBYDDNy-j1wh4QgBF7ybe-beaL0pkwnjnP_aq=CytzmbVAEA@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: www-style list <www-style@w3.org>
On Fri, Mar 29, 2013 at 10:18 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 3/29/13 1:03 PM, Tab Atkins Jr. wrote:
>> Oh, no, not at all.  You still want to return the used value *of the
>> 'width' property*.  'box-sizing' changes how the 'width' property is
>> interpreted when figuring out the width of the content box, but it
>> doesn't actually change the value of the 'width' property itself.
> Uh... it can't possibly work that way, because the used width participates
> in this equation in CSS2.1 section 10.3.3:
>     'margin-left' + 'border-left-width' + 'padding-left' + 'width' +
> 'padding-right' + 'border-right-width' + 'margin-right' = width of
> containing block

Sure, and 2.1 preceded the 'box-sizing' property.  (I'm completely
unsurprised that 'box-sizing' doesn't properly specify its affect on
computations like this, though.)

It should be something like "If box-sizing is 'content-box', use the
2.1 formula.  If it's 'padding-box', use 'margin-left' +
'border-left-width' + 'width' + 'border-right-width' + 'margin-right'.
If it's 'border-box', etc." + language about how to determine the size
of the content box given the various values.

> or in this one in CSS3 Box draft section 15.3 if you prefer:
>   start margin + start border + start padding + inline dimension + end
> padding + end border + end margin = inline dimension of containing block

Don't trust Box for anything worthwhile.

> So the used "inline dimension" or "width", depending on which of those specs
> you read, is 100% definitely affected by box-sizing.

I think it's just an old spec and a spec bug (/old spec), and
shouldn't be taken as indicative of anything.

Received on Friday, 29 March 2013 17:33:40 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:27 UTC