offsetWidth //返回盒模型的宽度(包括width+左右padding+左右border)
<style> #div1 { 200px; height:200px; border:2px solid red; padding:5px; margin:1px; background:green;} </style> <div id="div1"></div>
以上div1的offsetWidth为width+2*padding+2*border=200+2*5+2*2=214px
ps:offsetLeft = left+margin-left
offsetTop = top+margin-top