Skip to main content

DOMRect

A DOMRect describes the size and position of a rectangle.

MDN Reference

Extends

Methods

toJSON()

toJSON(): any;

The DOMRectReadOnly method toJSON() returns a JSON representation of the DOMRectReadOnly object.

MDN Reference

Returns

any

Inherited from

DOMRectReadOnly.toJSON

Properties

bottom

readonly bottom: number;

The bottom read-only property of the DOMRectReadOnly interface returns the bottom coordinate value of the DOMRect. (Has the same value as y + height, or y if height is negative.)

MDN Reference

Inherited from

DOMRectReadOnly.bottom


height

height: number;

The height property of the DOMRect interface represents the height of the rectangle. The value can be negative.

MDN Reference

Overrides

DOMRectReadOnly.height


left

readonly left: number;

The left read-only property of the DOMRectReadOnly interface returns the left coordinate value of the DOMRect. (Has the same value as x, or x + width if width is negative.)

MDN Reference

Inherited from

DOMRectReadOnly.left


readonly right: number;

The right read-only property of the DOMRectReadOnly interface returns the right coordinate value of the DOMRect. (Has the same value as x + width, or x if width is negative.)

MDN Reference

Inherited from

DOMRectReadOnly.right


top

readonly top: number;

The top read-only property of the DOMRectReadOnly interface returns the top coordinate value of the DOMRect. (Has the same value as y, or y + height if height is negative.)

MDN Reference

Inherited from

DOMRectReadOnly.top


width

width: number;

The width property of the DOMRect interface represents the width of the rectangle. The value can be negative.

MDN Reference

Overrides

DOMRectReadOnly.width


x

x: number;

The x property of the DOMRect interface represents the x-coordinate of the rectangle, which is the horizontal distance between the viewport's left edge and the rectangle's origin.

MDN Reference

Overrides

DOMRectReadOnly.x


y

y: number;

The y property of the DOMRect interface represents the y-coordinate of the rectangle, which is the vertical distance between the viewport's top edge and the rectangle's origin.

MDN Reference

Overrides

DOMRectReadOnly.y