px2rem.scss
Self adaption plugin for mobile development.
Install
npm install px2rem.scss --save
Usage
- In html
<head>
tag, addviewport
anddesignBaseWidth
,as below:
demo
- import
px2rem.config.min.js
file,
demo
Notice:this plugin need calculate the html tag base
font-size
before dom rendering,otherwise web page will initial depend onfont-size:16px
to calculaterem
value,this will cause page to rerender and repain.
- Before you use
mixins
inpx2rem.scss
, plz import firstly:
; html
Remarks
px2rem.scss
provide two sass mixin:
font-dpr - calculate font size
px2rem - convert px to rem
Notice:The default base font size is
16px
for html.
License
MIT