getBoundingClientRect 方法 有6个属性 top 、bottom、right、left、width和height
ie9以下浏览器只支持 getBoundingClientRect 方法的 top 、bottom、right、left属性;
ie9 和其它浏览器支持 getBoundingClientRect 方法 有6个属性 top 、bottom、right、left、width和height;
根据getBoundClientRect().width这个值来做字体的适配
(function () {
var html = document.documentElement;
function onWindowResize() {
html.style.fontSize = html.getBoundingClientRect().width / 20 + 'px';
}
window.addEventListener('resize', onWindowResize);
onWindowResize();
})();