1. rem单位方式,用法当前像素除以100。<!doctype html><html><head> <meta charset="utf-8" /> <meta name="viewport ...
1. rem单位方式,用法当前像素除以100。
<!doctype html><html><head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, user-scalable=no" /> <title>H5移动端</title> <meta name="format-detection" content="telephone=no"> <link rel="stylesheet" type="text/css" href="static/css/public.css" /> <script> (function (root) { var docEl = document.documentElement, timer = null, width, last; function changeRem () { width = docEl.getBoundingClientRect().width; if (last === width) { return; } last = width; root.rem = (width / 640) * 100; if (/ZTE U930_TD/.test(navigator.userAgent)) { root.rem = root.rem * 1.13; } docEl.style.fontSize = root.rem + 'px'; } changeRem(); root.addEventListener('resize', function () { clearTimeout(timer); timer = setTimeout(changeRem, 300); }); root.addEventListener('orientationchange', function () { clearTimeout(timer); timer = setTimeout(changeRem, 300); }); })(window, undefined); </script></head>
原标题:分享几种移动端标准头
关键词:
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。