关于手机尺寸的适配问题, 一般用每天查询来写固定的样式, 下面是通过 rem 来写样式信息, 这样就只需要写固定一版样式即可
引用代码
- var deviceWidth = document.documentElement.clientWidth;
- if(deviceWidth> 640) deviceWidth = 640;
- document.documentElement.style.fontSize = deviceWidth / 6.4 + 'px';
说明: 需要按照一个规格的设计稿尺寸来计算最好适用 rem 来算
来源: http://www.qdfuns.com/article/19371/f941294a0275a567dc80e0498634efbe.html