移動端不同解析度適配--使用flexible

來源:互聯網
上載者:User

標籤:one   style   換算   --   post   http   div   不同   相對路徑   

根據阿里手淘團隊發布的可伸縮布局方案amfe-flexible,git地址:https://github.com/amfe/lib-flexible。

使用方法:

lib-flexible庫的使用方法非常的簡單,只需要在Web頁面的<head></head>中添加對應的flexible_css.js,flexible.js檔案

第一種方法是將檔案下載到你的項目中,然後通過相對路徑添加:

<script src="build/flexible_css.debug.js"></script><script src="build/flexible.debug.js"></script>

或者直接載入阿里CDN的檔案:

<script src="http://g.tbcdn.cn/mtb/lib-flexible/0.3.4/??flexible_css.js,flexible.js"></script>

 

容器或組件寬高主要使用單位 rem ,字型大小則不變仍然使用單位 px

樣本地址:https://github.com/amfe/article/issues/17

還有一個約束是,如果針對iphone5 640*1136,因此我們限制最外層包裹的div最大寬度為 640px,表示10rem;

把視覺稿中的px轉換成rem的換算方法:要轉換的像素值 / 640px * 10

 

移動端不同解析度適配--使用flexible

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.