Element.clientWidth reference
4 March 2024 (Updated 4 March 2024)
On this page
The Element.clientWidth
property returns the inner width of an element in pixels, including padding but excluding borders, margins, and vertical scrollbars (if present).
Other notes
Element.clientWidth
will return zero for inline elements or elements with no CSS.Element.clientWidth
will round the value to an integer. To get a more accurate, fractional value, you can useElement.getBoundingClientRect()
.
Sources/links
Tagged:
Web APIs
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment