Bounding Client Rect

Back

getBoundingClientRect can be used to get the coordinates of the element in the DOM

const element = document.getElementById("container")
const { x, y, width, height, left, right, top, bottom} = element.getBoundingClientRect();