Get the width of a <div> element's top and left border:
The result of txt will be:
More "Try it Yourself" examples below.
The clientTop property returns the width of the top border of an element, in pixels.
This property does not include the element's top padding or top margin.
Tip: You can also use the style.borderTopWidth property to return the width of an element's top border.
Tip: To return the width of the left border of an element, use the clientLeft property.
This property is read-only.
Property | |||||
---|---|---|---|---|---|
clientTop | Yes | Yes | Yes | Yes | Yes |
Return Value: | A Number, representing the width of an element's top border, in pixels |
---|