<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                [TOC] ### 思想:(為手機而生) ~~~ 在手機端網站實現 自適應效果 使用rem代替 之前代碼當中的px 實現自適應 原理是通過引入JavaScript代碼然后根據設備的寬度來動態的設置 font-size的大小從而確定1rem的值 也可以使用JavaScript原生代碼實現動態復制 參看 ~~~ [另一種方法](http://www.softwhy.com/article-8545-1.html) ### 實質: ~~~ 將布局視口的寬度分成十等分 每一份就是1rem 且1rem=font-size的px值 ~~~ ### 使用方法: ~~~ 1. 引入<script src="http://g.tbcdn.cn/mtb/lib-flexible/0.3.2/??flexible_css.js,flexible.js"></script> 替換 <!-- <meta name="viewport" content="width=device-width, initial-scale=1.0"> --> ~~~ ~~~ 2. 在 vccode 的sccrem插件中 點擊 文件>首選項中搜索cssrem 設置"cssrem.rootFontSize": 64 值根據具體情況確定 (布局視口的寬度 640 就是64 布局視口的寬度750 就是75) ~~~ ### demo: ~~~ <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <!-- <meta name="viewport" content="width=device-width, initial-scale=1.0"> --> <script src="http://g.tbcdn.cn/mtb/lib-flexible/0.3.2/??flexible_css.js,flexible.js"></script> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <style> *{margin:0;padding:0} /* rem是相對于根元素,html的font-size而言 1rem=1rem (640) iphone7 vw=10rem 1rem=.853333rem(540) iphone5 vw=10rem 1rem=1.656rem iphone6plus vw=10rem */ /* flexible-->將布局視口的width等分成10rem; */ #app{ width:10rem; margin-left: auto; margin-right: auto; } .demo{ width: 5rem ; height: .266667rem; background: red; } </style> </head> <body> <div id="app"> <div class="demo"> </div> </div> <script> // 布局視口的width var vw = document.documentElement.clientWidth; //設備width var dw = screen.availWidth; // 設備像素比 var dpr = window.devicePixelRatio; console.log("vw:"+vw); console.log("dw:"+dw); console.log("dpr:"+dpr) </script> </body> </html> ~~~ ## [另外一種方法](http://www.softwhy.com/article-8545-1.html)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看