适配手机端浏览器

iphone5   iphone6  ipad  iphone6 plus 等等手机

<script>
(function() {
function a(d, c, e) {
if (d.addEventListener) {
d.addEventListener(c, e, false)
} else {
d.attachEvent('on' + c, e)
}
};

function b() {
var deviceWidth = document.documentElement.clientWidth;
if (deviceWidth > 750) deviceWidth = 750;
document.documentElement.style.fontSize = deviceWidth / 7.5 + 'px';
};
b();
a(window, 'resize', b)
}());
</script>

 配合rem来使用

如果你的设计图是 750 的,只需要除以 10 就得到了 rem 值 ,200px 就是 2rem

原文地址:https://www.cnblogs.com/yixiaoyang-/p/7520414.html