Re: [cssom-view] scrollWidth vs clientWidth

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) )

Garrett

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