Retrieves the width of the object including padding, but not including margin, border, or scroll bar.
Syntax
| JavaScript | |
|---|
Property values
Type: Integer
the width of the object, in pixels.
Examples
This example shows how the clientWidth property and the offsetWidth property measure document width differently. The width of the div is set to 200, and this is the value retrieved by the offsetWidth property, not the clientWidth property.
<div id=oDiv style="overflow:scroll; width:200; height:100"> . . . </div> <button onclick="console.log(oDiv.clientWidth)">client width</button> <button onclick="console.log(oDiv.offsetWidth)">offset widthY</button>
See also
- a
- address
- b
- bdo
- blockQuote
- body
- button
- caption
- cite
- code
- col
- colGroup
- custom
- dd
- div
- dl
- dt
- em
- embed
- fieldSet
- form
- hn
- html
- i
- img
- input type=button
- input type=checkbox
- input type=file
- input type=image
- input type=password
- input type=radio
- input type=reset
- input type=submit
- input type=text
- kbd
- label
- legend
- li
- meta
- object
- ol
- option
- p
- pre
- s
- samp
- script
- select
- small
- span
- strong
- sub
- sup
- table
- tBody
- td
- textArea
- tFoot
- th
- tHead
- tr
- u
- ul
- var
- Measuring Element Dimension and Location with CSSOM in Internet Explorer 9
Build date: 11/28/2012