English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
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 inline
clientTop will return0
.
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‹/›
All browsers fully support the clientTop property:
Property | |||||
clientTop | Yes | Yes | Yes | Yes | Yes |
Return Value: | A number representing the width of the element's top border, in pixels |
---|
HTML DOM Reference:HTML DOM clientLeft property