手机移动端初始rem 1rem = 100px

(function setDevice(deviceW){
  var html = document.documentElement;
  var hWidth = html.getBoundingClientRect().width;
  html.style.fontSize = hWidth/deviceW*100 + 'px';
})(750);

 

 

function setDevice(deviceW){
  var html = document.documentElement;
  var hWidth = html.getBoundingClientRect().width;
  html.style.fontSize = hWidth/deviceW*100 + 'px';
};

setDevice(750)

posted on 2017-01-17 14:05  vsmart  阅读(365)  评论(0编辑  收藏  举报