Giter Site home page Giter Site logo

h5-flexible's Introduction

一个H5适配方案 使用方法如下

  1. 在元素内添加<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">目的在于定义viewport的宽度等于屏幕的宽度
  2. 引入flexible.js,在元素内添加 <script src="fexible.js"> </script>, 如果HTML中没有添加过<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">fexible.js会在文档中动态添加
  3. 编写CSS时元素的width/height、margin、padding等使用rem作为单位,属性的数值 = 设计稿上标注的数值 / 设计稿的宽度 可以使用sass函数减少px转化为rem的工作量:
@function rem($pixels, $design_draft_width: ?) {
   @return $pixels / $design_draft_width + rem;
}

?改为设计稿的宽度

更多信息点击这里

h5-flexible's People

Contributors

smarkseven avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.