clientLeft property
The property clientLeft contains
the width of the left border
(border-left
value). More precisely, clientLeft
contains the value of the indent of the
inner part of an element from the outer. In
most cases, clientLeft is equal to
border-left, but if the document
is arranged from right to left (for example,
Arabic), then clientLeft may include
the scrollbar width on the left.
Syntax
element.clientLeft;
Example
Let's find out the width of the left border of an element:
<div id="elem"></div>
#elem {
width: 100px;
height: 100px;
border: 10px solid black;
}
let elem = document.querySelector('#elem');
console.log(elem.clientLeft);
The code execution result:
10
See also
-
the
clientTopproperty
that contains the width of the top border