asp.net.ph

Skip Navigation Links

clientWidth Property

DHTML Object Properties   DHTML Objects


Retrieves the width of the object, in pixels, without taking into account any margin, border, scroll bar, or padding that might have been applied to the object.

Syntax


HTML N/A
Script [ iWidth = ] object.clientWidth

Possible Values


iWidth Integer specifying the width of the object, in pixels.

The property is read-only with no default value.

Example

The following example demonstrates the difference between the clientWidth style attribute and the offsetWidth property in measuring the document width. Note The DIV's width is set to 200, and this is the value retrieved by the offsetWidth, not the clientWidth.

<div id=oDiv 
  STYLE="overflow:scroll; width:200; height:100">
  . . . </div>
<button onclick="alert ( oDiv.clientWidth )">
  client width</button>
<button onclick="alert ( oDiv.offsetWidth )">
  offset width</button>

 Show me 

See Also

Measuring Element Dimension and Location, The Browser Screen



>

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note