zoukankan      html  css  js  c++  java
  • 使用js rem动态改变字体大小,自适应

    <html>

    <head>

    <meta charset="utf-8">

    <script>

      console.log(window.devicePixelRatio);

      var iScale = 1;

      iScale = iScale/window.devicePixelRatio;

      document.write('<meta name="viewport" content="width=device-width,user-scable=no,initial-scale=' + iScale + ',minimum-scale=' + iScale + ',maximum-scale=' + iScale + '"/>');

      //console.log(document.documentElement.clientWidth);

      var iWidth = document.documentElement.clientWidth/16;

      document.getElementsByTagName('html')[0].style.fontSize = iWidth + 'px';

    </script>

    </head>

    </html>

  • 相关阅读:
    基于Twisted的简单聊天室
    小学题的python实现
    初识Go(8)
    初识Go(7)
    初识Go(6)
    初识Go(5)
    初识Go(4)
    初识Go(3)
    初识Go(2)
    初识Go(1)
  • 原文地址:https://www.cnblogs.com/dayin1/p/10964627.html
Copyright © 2011-2022 走看看