W3C home > Mailing lists > Public > www-style@w3.org > February 2014

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

From: Thomas Rosenau <rosenau@seitenbau.com>
Date: Tue, 14 Jan 2014 09:24:59 +0000
To: www-style@w3.org
Message-ID: <1214254719.288271.1389682391154.JavaMail.zimbra@seitenbau.com> (sfid-20140114_092506_241893_CB471B47)
Citing from http://dev.w3.org/csswg/css-box/

Section 19.1:
> The space taken up by the scrollbars affects the computation of the dimensions in the rendering model.

Does it? How so?
The reason I'm asking is because I observe different behaviour in Firefox/Chrome:

<div style="width:20px;padding:20px;overflow:scroll"></div>
<script>
console.log(getComputedStyle(document.querySelector('div')).width);
</script>

Firefox returns '20px', while Chrome returns '5px' (with scrollbars being 15px wide)
Which one is correct?


Section 6.2:
> If an element has scrollbars ..., then any space taken up by the scrollbars should be excluded from (subtracted from the dimensions of) any containing block formed by that element.

At what point precisely should they be substracted?
It should be made clear that vertical scrollbars affect the content edges of that element. That is, the content box is given a width of [width] - [scrollbar width], so the padding box including scrollbars is just as wide as the padding box of the same element without scrollbars.
At least that's how all browsers currently implement scrollbars.

Should this be mentioned in section 15.3./15.4.? Or even in Figure 2 (box model illustration)?

Best regards
Thomas Rosenau
Received on Tuesday, 18 February 2014 17:31:53 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:19 UTC