美文网首页
clientWidth | offsetWidth | clie

clientWidth | offsetWidth | clie

作者: 逗婆苍穹 | 来源:发表于2022-11-07 16:20 被阅读0次
  • clientWidth 和 clientHeigh
 clientWidth = width + paddingLeft + paddingRight
 clientHeigh = height + paddingTop + paddingBottom

 clientTop = border.top(上边框的宽度)
 clientLeft = border.left(左边框的宽度)
  • offsetWidth和offsetHight 、 offsetTop和offsetLeft
 offsetWidth = width + 左右padding + 左右border
 offsetHeith = height + 上下padding + 上下border

 offsetTop:当前元素 上边框 外边缘 到 最近的已定位父级(offsetParent) 上边框 内边缘的 距离。 
 如果父级都没有定位,则分别是到body 顶部 和左边的距离

 offsetLeft:当前元素 左边框 外边缘 到 最近的已定位父级(offsetParent) 左边框 内边缘的            
 距离。如果父级都没有定位,则分别是到body 顶部 和左边的距离
  • scrollWidth和scrollHeight 、 scrollTop和scrollLeft
  scrollWidth:获取指定标签内容层的真实宽度(可视区域宽度+被隐藏区域宽度)
  scrollHeight:获取指定标签内容层的真实高度(可视区域高度+被隐藏区域高度)

  scrollTop :内容层顶部 到 可视区域顶部的距离
  scrollLeft:内容层左端 到 可视区域左端的距离
  • clientX,clientY,screenX,screenY,offsetX,offsetY
https://blog.csdn.net/qq_40184012/article/details/79564412

相关文章

网友评论

      本文标题:clientWidth | offsetWidth | clie

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