1、chrome浏览器,打开一个页面

2、选中要查看的页面

手动查看页面上元素到页面顶端的距离

3、点击 Add attribute

4、添加  id="xxxx"

5、document.querySelector("#xxx").getBoundingClientRect()

手动查看页面上元素到页面顶端的距离

相关文章: