client属性

86 阅读1分钟

1.png

2.png

  • clientWidth=宽度+内边距
  • offsetWidth=宽度+内边距+边框
  • clientHeight=高度+内边距
  • offsetHeight=高度+内边距+边框

3.png

  • clientLeft / clientTop: 左边框 和 顶部边框
  • offsetLeft / offsetTop: 距离第一个定位祖先元素偏移位 || body