Visit Mozilla.org

DOM:element.scrollWidth

From MDC

« Gecko DOM Reference

Contents

[edit] Summary

scrollWidth is a read–only property that returns either the width in pixels of the content of an element or the width of the element itself, whichever is greater. If the element is wider than its content area (for example, if there are scroll bars for scrolling through the content), the scrollWidth is larger than the clientWidth.

[edit] Syntax and values

var xScrollWidth = element.scrollWidth;

xScrollWidth is the width of the content of element in pixels.

[edit] Example

<div id="aDiv"
     style="width: 100px; height: 200px; overflow: auto;"
>-FooBar-FooBar-FooBar</div>
<br>
<input type="button" value="Show scrollWidth"
       onclick="alert(document.getElementById('aDiv').scrollWidth);">

[edit] Specification

There is no W3C specification for scrollWidth.

[edit] References

MSDN scrollWidth reference

[edit] See also