getBoundingClientRect
getBoundingClientRect is a method on Element that returns the element’s bounding box as a DOMRectReadOnly object. The rectangle describes the size of the element and its position relative to the viewport, i.e., the visible portion of the document in the window.
The DOMRect includes properties left, top, right, bottom, width, height, and aliases x and y for left
If the element is not in the render tree or is display: none, the rect may report
Usage and considerations: getBoundingClientRect is commonly used to position overlays such as tooltips and popovers, to
In practice, developers rely on it to obtain an element’s on-screen position and size quickly and to