The width of the left border of an element in pixels. It includes the width of the vertical scrollbar if the text direction of the element is right–to–left and if there is an overflow causing a left vertical scrollbar to be rendered. clientLeft
does not include the left margin or the left padding. clientLeft
is read-only.
When layout.scrollbar.side
preference is set to 1 or to 3 and when the text-direction is set to RTL, then the vertical scrollbar is positioned on the left and this impacts the way clientLeft is computed.
Note: This property will round the value to an integer. If you need a fractional value, use element.getBoundingClientRect()
.
Note: When an element has display: inline
, clientLeft
returns 0
regardless of the element's border.
Syntax
var left = element.clientLeft;
Example
padding-top
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
padding-bottom
Left Top Right Bottom margin-top margin-bottom border-top border-bottom
Specifications
Specification | Status | Comment |
CSS Object Model (CSSOM) View ModuleThe definition of 'clientLeft' in that specification. | Working Draft |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
clientLeft
|
Chrome
Full support 43 |
Edge
Full support 12 |
Firefox
Full support 1 |
IE
Full support 6 |
Opera
Full support 8 |
Safari
Full support 6 |
WebView Android
Full support 43 |
Chrome Android
Full support 43 |
Firefox Android
Full support 4 |
Opera Android
Full support 10.1 |
Safari iOS
Full support 6 |
Samsung Internet Android
Full support 4.0 |
Legend
- Full support
- Full support
Notes
clientLeft
was first introduced in the MS IE DHTML object model.
The position of the vertical scrollbar in right–to–left text direction set on the element will depend on the layout.scrollbar.side
preference
Gecko-based applications support clientLeft
starting with Gecko 1.9 (Firefox 3, implemented in bug 111207). This property is not supported in Firefox 2 and earlier.
Element.clientLeft by Mozilla Contributors is licensed under CC-BY-SA 2.5.