Name

ClientRect — an element bounding box

Synopsis

A ClientRect object describes a rectangle, using Window or viewport coordinates. The getBoundingClientRect() method of Element returns objects of this kind to describe the on-screen bounding box of an element. ClientRect objects are static: they do not change when the element they describe changes.

Properties

readonly float bottom

The Y position, in viewport coordinates, of the bottom edge of the rectangle.

readonly float height

The height, in pixels, of the rectangle. In IE8 and before, this property is not defined; use bottom-top instead.

readonly float left

The X position, in viewport coordinates, of the left edge of the rectangle.

readonly float right

The X position, in viewport coordinates, of the right edge of the rectangle.

readonly float top

The Y position, in viewport coordinates, of the top edge of the rectangle.

readonly float width

The width, in pixels, of the rectangle. In IE8 and before, this property is not defined; use right-left instead.

Get JavaScript: The Definitive Guide, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.