Using getBoundingClientRect to Get an Element’s Size and Position
getBoundingClientRect is part of the JavaScript DOM API and allows to get various data about the size/position of elements. In this article, you will use getBoundingClientRect to get an element’s size and position.