获取元素的高度

let f=document.getElementById('screen-third')
1、console.log("f",f.getBoundingClientRect().height);  
2、let k= document.defaultView.getComputedStyle(f,'').height;

网页可见区域高:document.body.clientHeight

网页正文全文高:document.body.scrollHeight
网页可见区域高(包括边线的高):document.body.offsetHeight
网页被卷去的高:document.body.scrollTop

屏幕分辨率高:window.screen.height

posted @ 2021-03-29 18:41  一江春水向东刘小姐  阅读(272)  评论(0编辑  收藏  举报