HTML DOM clientTop property
Example
Get the width of the top and left borders of the div element:
var
elmnt
=
document
.
getElementById
(
"
myDIV
"
)
;
var
txt
=
"
The width of the top border:
"
elmnt
.
clientTop
"
px
"
;
txt
+=
"
The width of the left border:
"
elmnt
.
clientLeft
"
px
"
;
Try it »
Definition and Usage
clientTop represents the width of the top border of an element, measured in pixels.
clientTop does not include the left margin and left padding.
Tip: You can use the style.borderTopWidth property to get the width of the element's top border.
Tip: To return the width of the element's left border, you can use clientLeft attribute.
clientLeft is read-only.

Browser support
| property | |||||
|---|---|---|---|---|---|
| clientTop | Yes | Yes | Yes | Yes | Yes |
Syntax
element.clientTop
Technical Details
| Return Value: | Returns an integer representing the width of the element's top border. |
|---|
Element object