English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML DOM clientTop property

HTML DOM Element Object

clientTopA read-only property that returns the width of the top border of an element in pixels.

The clientTop property does not include the top margin or the top margin.

UsageclientLeftThe property returns the width of the element's left border.

Note:when the element haswhen display is inlineclientTop will return0.

Syntax:

element.clientTop
var elem = document.querySelector("div");
var txt = "Border top width: " + elem.clientTop + "px<br>";
txt += "Border left width: " + elem.clientLeft + "px";
Test to see‹/›

Browser Compatibility

All browsers fully support the clientTop property:

Property
clientTopYesYesYesYesYes

Technical Details

Return Value:A number representing the width of the element's top border, in pixels

Related References

HTML DOM Reference:HTML DOM clientLeft property

HTML DOM Element Object