{{ DomRef() }}
Summary
Returns the inner height of an element in pixels, including padding but not the horizontal scrollbar height, border, or margin.
clientHeight
can be calculated as CSS height
+ CSS padding
- height of horizontal scrollbar (if present).
Syntax
var h = element.clientHeight;
h
is an integer representing height of the element
in pixels.
Note: This property will round the value to an integer. If you need a fractional value, use {{ domxref("element.getBoundingClientRect()") }}.
clientHeight
is read–only.
Example
padding-top
Gentle, individualistic and very loyal, Birman cats fall between Siamese and Persian in character. If you admire cats that are non aggressive, that enjoy being with humans and tend to be on the quiet side, you may well find that Birman cats are just the felines for you.
All Birmans have colorpointed features, dark coloration of the face, ears, legs and tail.
Cat image and text coming from https://www.best-cat-art.com/
padding-bottom
Specification
Specification | Status | Comment |
---|---|---|
{{SpecName('CSSOM View', '#dom-htmlelement-clientheight', 'clientheight')}} | {{Spec2('CSSOM View')}} |
Notes
clientHeight
is a non-standard, HTML-specific property introduced in the Internet Explorer object model.
offsetLeft
returns the position the upper left edge of the element; not necessarily the 'real' left edge of the element. This is important for span elements in flowed text that wraps from one line to the next. The span may start in the middle of the page and wrap around to the beginning of the next line. The offsetLeft
will refer to the left edge of the start of the span, not the left edge of text at the start of the second line. Therefore, a box with the left, top, width and height of offsetLeft, offsetTop, offsetWidth
and offsetHeight
will not be a bounding box for a span with wrapped text. (And, I can't figure out how to find the leftmost edge of such a span, sigh.)
References
- {{ MSDN("ms533563", "clientHeight Property") }}
- {{ MSDN("ms530302", "Measuring Element Dimension and Location") }}
See Also
{{ languages( { "fr": "fr/DOM/element.clientHeight", "ja": "ja/DOM/element.clientHeight", "pl": "pl/DOM/element.clientHeight", "zh-cn": "cn/DOM/element.clientHeight" } ) }}