What unit does getBoundingClientRect return in?

1.5k views Asked by At

I know that getBoundingClientRect() returns an object of type ClientRect or DOMRect, and each usually has properties like x, y, width, height, and more. And if you typeof those properties, you get Number.

So my question is, that Number is an amount of what? Pixels px, points pt, percentage %, and things like that are possible answers. I think it is pixels, but I am not completely sure about that. Could anyone confirm this?

1

There are 1 answers

2
Lakshya Raj On BEST ANSWER

Thank you to @Ken White for confirming the answer:

getBoundingClientRect() returns an array of Numbers that specify an amount of pixels (px).