HTML 各种宽高度

element.clientWidth   //元素的实际宽度,不算边框

element.clientHeight  //元素的实际高度,不算边框

element.offsetWidth   //元素的实际宽度,加上边框

element.offsetHeight  //元素的实际高度,加上边框

element.scrollWidth  //这个说法很多,我测试下来应该是元素实际宽度-滚动条的宽度

element.scrollHeight  //这个说法很多,我测试下来应该是元素实际高度-滚动条的高度

element.offsetLeft   //相对于父对象的距离,ie下如果position设为relative,则是相对于window的距离

element.offsetTop   //相对于父对象的距离,ie下如果position设为relative,则是相对于window的距离

window.screenLeft   //当前窗口距离屏幕距离 only for IE

window.screenX   //当前窗口距离屏幕距离 not for IE

window.innerWidth  //当前窗口大小(内)not for IE

window.outerWidth  //当前窗口大小(外)not for IE

window.screen.width //当前屏幕分辨率

window.screen.availWidth //当前屏幕可用分辨率

你可能感兴趣的:(HTML 各种宽高度)