h5页面自适应手机屏幕宽度
在html head中添加:
<script type="text/javascript">
var phoneScale = parseInt(window.screen.width)/640;
document.write('<meta name="viewport" content="width=640, minimum-scale = '+ phoneScale +', maximum-scale = '+ phoneScale +', target-densitydpi=device-dpi">');
</script>
在css中给body添加属性:
width: 640px;