scrollWidth Property Sample

This sample demonstrates the use of the scrollWidth property to retrieve the width of the viewable content.

The scrollWidth property is read-only, allowing you to obtain the actual height of the viewable content. Even though the width of this div is 400px, the width inside the scrolling text box might be less, since the wrapped text may not use the entire area within the object. The scrollWidth dimension can be useful for a variety of reasons; for example, the width of the div could be set to the scrollWidth to conserve vertical space while respecting the set height as a maximum.




[Right-click and choose View Source from the shortcut menu.]

© 2007 Microsoft Corporation. All rights reserved. Terms of use.