Re: [css3-box] How do scrollbars affect width calculation?

On 1/26/14 3:53 PM, Sebastian Zartner wrote:
> No, I just put Thomas' code into a file. For clarity I attached the file.

Interesting.  So here's a modified version of this testcase that's worth 
considering:

<!DOCTYPE html>
<div style="width:20px;padding:20px;overflow:scroll; border: 1px solid 
purple">
   <div style="background: green; height: 20px"></div>
</div>
<div style="width:20px;padding:20px;overflow:visible; border: 1px solid 
purple">
   <div style="background: green; height: 20px"></div>
</div>
<script>
alert(getComputedStyle(document.querySelector('div')).width);
alert(getComputedStyle(document.querySelector('div').firstElementChild).width);
</script>

the actual rendering looks the same across UAs (about 5px for the inner 
div in the overflow:scroll case, for me).  The first getComputedStyle 
returns different values in different UAs, as you note.  The second one 
returns 5px reliably.

I have no idea what browsers are actually doing here.

> Will this behavior change with dropping the '-moz' prefix[1]?

No, since box-sizing is not involved in any way.

-Boris

Received on Monday, 27 January 2014 03:17:42 UTC