HTML DOM Element getBoundingClientRect()
HTML DOM Element getBoundingClientRect() Method
The getBoundingClientRect() method is used to return DOMRect object. In other words, it returns the size of an element and its position relative to the viewport. It consists of eight parts:-
- left
- top
- right
- bottom
- x
- y
- width
- height
Syntax:-
Its syntax is:- element.getBoundingClientRect()
Return:-
Its return is:- DOMRect object