zoukankan      html  css  js  c++  java
  • rem布局计算(移动端,pc端有兼容性)

     1 <!DOCTYPE html>
     2 <html>
     3 <head lang="en">
     4     <script>
     5         function rootREM() {
     6             var W = document.documentElement.clientWidth;
     7             W = (W <= 640) ? W : 640;
     8             document.documentElement.style.fontSize = W / 10 + 'px';
     9             document.body.style.fontSize = W / 20 + 'px';
    10         }
    11         window.onresize = function () {
    12             rootREM()
    13         };
    14     </script>
    15     <meta charset="UTF-8">
    16     <title></title>
    17     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
    18 </head>
    19 <body onload="rootREM()">
    20 
    21 <div style="max- 640px;">
    22     <br/>你好,世界!
    23     <br/>你好,世界!
    24     <br/>你好,世界!
    25     <br/>你好,世界!
    26     <br/>你好,世界!
    27     <br/>你好,世界!
    28     <br/>你好,世界!
    29     <br/>你好,世界!
    30     <br/>你好,世界!
    31     <br/>你好,世界!
    32     <br/>你好,世界!
    33     <br/>你好,世界!
    34     <br/>你好,世界!
    35     <br/>你好,世界!
    36     <br/>你好,世界!
    37     <br/>你好,世界!
    38     <br/>你好,世界!
    39     <br/>你好,世界!
    40     <br/>你好,世界!
    41     <br/>你好,世界!
    42     <br/>你好,世界!
    43     <br/>你好,世界!
    44     <br/>你好,世界!
    45 
    46 </div>
    47 
    48 </body>
    49 </html>
  • 相关阅读:
    jquery 插件 国外
    数据库层面记录操作日志
    VS2015 发布
    SSO 单点登录
    在C#程序中模拟发送键盘按键消息
    C#中的DBNull、Null、""和String.Empty
    .Net 中通用的FormatString格式符整理
    验证码图片生成代码
    C#操作Excel知识点
    C#获取存储过程的 Return返回值和Output输出参数值
  • 原文地址:https://www.cnblogs.com/sxz2008/p/7651804.html
Copyright © 2011-2022 走看看