JS盒模型

JS盒模型 *****

1、width | height

  • parseInt(getComputedStyle(ele, null).getPropertyValue('width'))
  • parseInt(getComputedStyle(ele, null).getPropertyValue('height'))

2、padding + width | padding + height

  • clientWidth
  • clientHeight

3、border + padding + width | border + padding + height

  • offsetWidth
  • offsetHeight

4、结合绝对定位,距离最近定位父级的Top | Left

  • offsetTop
  • offsetLeft
posted @ 2018-10-19 16:06  星牧  阅读(126)  评论(0编辑  收藏  举报