CKTIS / JavaScript
DOMRect.height — rectangle height
DOMRect.height is a rectangle's writable vertical dimension. It can be negative and affects the computed top and bottom edges.
Version: ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
Syntax
rect.height
rect.height = valueDOMRect.height denotes an instance property read as rect.height. It stores an unrestricted double vertical dimension, allowing fractions, negative values, NaN, and infinities. In new DOMRect(x, y, width, height), it is the fourth argument and defaults to 0.
With DOMRect, you can assign rect.height = value; with DOMRectReadOnly, the property is read-only. Assignment leaves y unchanged. For finite values, top is the minimum of y and y + height, while bottom is the maximum. Negative height therefore places top above y.
This is a Web API from Geometry Interfaces Module Level 1, not a feature of a particular ECMAScript edition. Check availability in the target browser; Node 24 in the repository does not establish browser support.
Examples
const rect = new DOMRect(10, 20, 30, 40);
console.log(rect.height);
rect.height = -8;
console.log(rect.height, rect.y, rect.top, rect.bottom);Result
40 -8 20 12 20
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.