Easy Tutorial
❮ Prop Document Inputencoding Prop Nav Cookieenabled ❯

HTML DOM clientTop Property

Element Object

Example

Get the width of the top and left borders of a div element:

var elmnt = document.getElementById("myDIV");
var txt = "Top border width: " + elmnt.clientTop + "px<br>";
txt += "Left border width: " + elmnt.clientLeft + "px";

Definition and Usage

clientTop represents the width of an element's top border, 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 the clientLeft property.

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

❮ Prop Document Inputencoding Prop Nav Cookieenabled ❯