一般做移动web的时候都会用到JQuery Mobile,可是把JQuery Mobile的CSS和JS文件引入以后怎么还是不能适配手机屏幕,原来是要加入一行
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
这一条至关重要,意思是使html的width和设备屏幕width相等,且不让用户缩放网页,适配妥妥的
下面是完整的head
<span style="white-space:pre"> </span><link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css">
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">