zoukankan      html  css  js  c++  java
  • 移动前端自适应解决方案和比较

    原文:https://www.jb51.net/article/128527.htm
    参考:https://www.cnblogs.com/zsxblog/archive/2016/04/02/5347783.html
    <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" /> <meta content="telephone=no" name="format-detection" /> <meta name="format-detection" content="email=no" /> <meta http-equiv="Cache-Control" content="no-cache"/> <title>响应式布局</title> <style> html{font-size: 20px; 100%;height: 100%;} body{margin: 0;padding: 0;} header,footer{ 100%;background: #17A578;color: #fff;font-size:1rem;text-align: center;line-height: 2rem;} .footer{position: fixed;bottom: 0;} .box{} .public{ 5rem;height: 5rem;font-size: 1.2rem;display: inline-block;text-align: center;color: #fff;line-height: 5rem;margin-top: 1rem;} .left{background: #f00;} .center{background: #048F74;} .right{background: #000;} </style> </head> <body> <header>页面头部</header> <div class="box"> <div class="public left">左</div> <div class="public center">中</div> <div class="public right">右</div> <div class="public left">左</div> <div class="public center">中</div> <div class="public right">右</div> </div> <footer class="footer">页面底部</footer> <script> (function (doc, win) { var docEl = doc.documentElement, resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize', recalc = function () { var clientWidth = docEl.clientWidth; if (!clientWidth) return; if(clientWidth>=640){ docEl.style.fontSize = '40px'; }else{ docEl.style.fontSize = 40 * (clientWidth / 640) + 'px'; } }; if (!doc.addEventListener) return; win.addEventListener(resizeEvt, recalc, false); doc.addEventListener('DOMContentLoaded', recalc, false); })(document, window); </script> </body> </html>

    *其中40px是个参数,可以设置为任意值。例如:设计图宽度为200px,则width:5rem;

      

    原文:https://www.cnblogs.com/zsxblog/archive/2016/04/02/5347783.html

  • 相关阅读:
    LeetCode-198-打家劫舍
    LeetCode-279-完全平方数
    LeetCode-91-解码方法
    Redis RDB 分析工具 rdbtools 说明(转载)
    ftp软件下载,ftp软件到底在哪里下载
    element-ui组件库二次开发——打包、上传npm
    ftp客户端工具,这6款好用的ftp客户端工具,站长们必不可少的常用工具!
    不会用Java Future,我怀疑你泡茶没我快, 又是超长图文!!(转载)
    ftp管理软件,ftp管理软件怎么使用
    Android连载22-自定义广播之标准广播发送(转载)
  • 原文地址:https://www.cnblogs.com/suhaihong/p/9228933.html
Copyright © 2011-2022 走看看