Re: [cssom-view] scrollWidth vs clientWidth

On Wed, Aug 18, 2010 at 11:32 AM, David Flanagan
<> wrote:
> Tab Atkins Jr. wrote:
>> Changes made:
> The diagram makes it clear what happens when an element's content is wider
> than the content area. What about the opposite, though: what if the content
> is smaller than the content area.  Is scrollWidth the same as clientWidth in
> that case, or is it smaller?

Same.  If the content doesn't overflow the content area, then the
content area is whatever is given by the appropriate CSS rules.

data:text/html,<!doctype html><div style="width: 400px; padding: 50px;
border: 2px; overflow:scroll;" id=foo>foo foo</div><script>var el =
document.getElementById('foo'); alert(el.clientWidth + "\n" +


Received on Thursday, 19 August 2010 03:15:29 UTC