美文网首页
移动端 html + 字体自适应

移动端 html + 字体自适应

作者: wlianfu | 来源:发表于2018-08-28 12:56 被阅读13次
    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no">
      <meta name="theme-color" content="#000000">
      <meta name="renderer" content="webkit">
      <meta name="google" content="notranslate">
      <meta name="format-detection" content="telephone=no">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <title>数据中心</title>
      <script src="https://as.alipayobjects.com/g/component/fastclick/1.0.6/fastclick.js"></script>
      <script>
        if ('addEventListener' in document) {
          document.addEventListener('DOMContentLoaded', function () {
            FastClick.attach(document.body);
          }, false);
        }
        if (!window.Promise) {
          document.writeln('<script src="https://as.alipayobjects.com/g/component/es6-promise/3.2.2/es6-promise.min.js"' + '>' + '<' + '/' + 'script>');
        }
      </script>
    </head>
    
    <body>
      <noscript>
        <strong>您的浏览器没有启动 JavaScript 脚本,请启用后再试!</strong>
      </noscript>
      <div id="app"></div>
      <script>
        (function (doc, win) {
          var docEl = doc.documentElement,
            resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
            recalc = function () {
              var clientWidth = docEl.clientWidth;
              if (!clientWidth) return;
              docEl.style.fontSize = 20 * (clientWidth / 750) + 'px';
            };
          if (!doc.addEventListener) return;
          win.addEventListener(resizeEvt, recalc, false);
          doc.addEventListener('DOMContentLoaded', recalc, false);
        })(document, window);
      </script>
    </body>
    </html>
    

    相关文章

      网友评论

          本文标题:移动端 html + 字体自适应

          本文链接:https://www.haomeiwen.com/subject/jovfwftx.html