登录后复制 ;var aa = document.createElement('div'); aa.style.cssText = '\n position: absolute;\n left: -9999px;\n font-size: 14px;\n font-family: Arial, sans-serif;\n '; aa.textContent = 'BrowserScan ClientRects Test'; document.body.appendChild(aa); var ab = aa.getClientRects(); var ac = Array.from(ab).map(function(zz) { debugger; return { 'top': zz['top'], 'right': zz['right'], 'bottom': zz['bottom'], 'left': zz['left'], 'width': zz['width'], 'height': zz['height'] }; }); document['body']['removeChild'](aa); console.log(JSON.stringify(ac)); 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20. 原创作者: angdh 转载于: https://blog.51cto.com/angdh/11598855