美文网首页
HTML各种宽高

HTML各种宽高

作者: 流影划云 | 来源:发表于2019-07-01 14:29 被阅读0次

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各种宽高

      本文链接:https://www.haomeiwen.com/subject/sfzdeftx.html