HTML各种宽高

documentElement and Elements:

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

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

element.scrollWidth // 元素的实际宽度 - 滚动条的宽度

element.scrollHeight // 元素的实际高度 - 滚动条的高度

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

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

element.offsetLeft // 边框外,相对于window的左距离

element.offsetTop // 边框外,相对于window的上距离

window:

window.screenX //浏览器距离屏幕左部距离

window.screenY // 浏览器距离屏幕顶部距离

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

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

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

window.screen.height // 当前屏幕分辨率高度

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

window.screen.availHeight // 当前屏幕可用分辨率高度


HTML各种宽高_第1张图片

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