通过viewport来适配
<script>
(function(){
var w=window.screen.width;
console.log(w);//获取屏幕尺寸
var targetW=320;//之后所有的都是按照320来做
var scale=w/targetW;//缩放值:当前尺寸/目标尺寸
var meta=document.createElement("meta");
meta.name="viewport";
meta.content="user-scalable=no,initial-scale="+scale+",minimum-scale="+scale+",maximum-scale="+scale+""
document.head.appendChild(meta);
})()
</script>
<!--
<meta name="viewport" content="user-scalable=no,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
-->
<style>
div{
width:80px;
height:100px;
float:left;
border:1px solid #000;
box-sizing:border-box;
}
</style>
<div></div>
<div></div>
<div></div>
<div></div>