Re: Behaviour of getComputedStyle with box-sizing: border-box

On Thu, 16 Jun 2011 06:09:46 +0200, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> Or to put this in testcase terms:
>
>    <style>
>      body { width: 200px; }
>      div { width: auto; box-sizing: border-box; padding: 10px; }
>    </style>
>    <body><div></div></body>
>
> The question is whether getComputedStyle for 'width' on the div should  
> return 180px or 200px (neither of which is the CSS 2.1 computed value;  
> the former is the used width and the latter is what would work for  
> round-tripping).

Per the specification that should be 180px. Not sure it is worth special  
casing box-sizing.

http://dev.w3.org/csswg/cssom/#dom-window-getcomputedstyle
http://dev.w3.org/csswg/cssom/#resolved-value


> Note also https://bugzilla.mozilla.org/show_bug.cgi?id=520992 (which  
> seems to be the only Gecko bug report related to this I've found).
>
> -Boris


-- 
Anne van Kesteren
http://annevankesteren.nl/

Received on Sunday, 19 June 2011 13:35:04 UTC