js代码
//js动态设置页面的像素比
var iScale=1;
iScale=iScale/window.devicePixelRatio;
document.write('<meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=no,' +
'initial-scale='+iScale+',maximum-scale='+iScale+',minimum-scale='+iScale+'">');
var iWidth=document.documentElement.clientWidth;
document.getElementsByTagName("html")[0].style.fontSize = iWidth/10+"px";
比如720的设计图纸,h2字体大小36px,宽度400px,那么就这样写:
h2{
font-size: 36/72rem;
width: 400/72rem;
}