让HTML页面缩放适应移动客户端尺寸

多的不说了,直接看代码吧

<html lang="en">
<head>
	<meta http-equiv = "X-UA-Compatible" content = "IE=edge,chrome=1" />
	<meta name="apple-mobile-web-app-capable" content="yes" />
	<meta name="apple-touch-fullscreen" content="YES" />
	<script type="text/javascript">
	var w =  screen.width;
	var rate = "0.55";
	switch(w){
				case 320:
                case 640:
                    rate = "0.5";
                    break;
                case 365:
                case 720:
                case 375:
                case 750:
                    rate = "0.585";
                    break;
                case 414:
                case 1242:
                case 1080:
                    rate = "0.64";
                    break;
                default:
                    rate = "0.55";
                    break;
	}
	document.write("<meta name=‘viewport‘ content=‘width=device-width,initial-scale="+rate+", minimum-scale=0.2, maximum-scale=1, user-scalable=no‘>");
	</script>
	<meta charset="UTF-8">
	<title>DEMO</title>
	<!-- atwind | ChaosStudio http://cszi.com -->
	<link rel="stylesheet" href="css/normalize.css">

  。。。。

后面的就略掉了。

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。