W3C home > Mailing lists > Public > www-style@w3.org > August 2010

Re: [cssom-view] scrollWidth vs clientWidth

From: Garrett Smith <dhtmlkitchen@gmail.com>
Date: Fri, 20 Aug 2010 10:57:57 -0700
Message-ID: <AANLkTin6NegEhAGTqWyGeZvEZEki-+m-0KPqkE-48cQp@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: David Flanagan <david@davidflanagan.com>, Anne van Kesteren <annevk@opera.com>, www-style@w3.org
On 8/18/10, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
> On Wed, Aug 18, 2010 at 11:32 AM, David Flanagan
> <david@davidflanagan.com> wrote:
>> Tab Atkins Jr. wrote:
>>> Changes made:
>>> http://www.xanthir.com/diagrams/scrollwidth-clientwidth.html
>> 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.

The scrollWidth property returns scrollable width of the element, in
pixels, rounded. The scrollable width of the element is the width of
the element that can be scrolled.

When CSS overflow values "auto" or "scroll" apply, the scrollable
width of the element can exceed the dimensions of an element and
scrollbars appear. The scrollWidth retrieves the scrollable width of
the content of the element.

The value is rounded is in pixels and is rounded.

 round( Max(content_width, declared_width) )

Received on Friday, 20 August 2010 18:01:01 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:49:46 UTC