getting element position in js

Table of Contents

element = document.querySelector("#element")
const elementBoundingRect = element.getBoundingClientRect();
elementBoundingRect.top
elementBoundingRect.bottom
elementBoundingRect.left
elementBoundingRect.right

_20240125_162143element-box-diagram.png

Backlinks

Author: Linfeng He

Created: 2024-04-03 Wed 20:20