Skip to content

rem响应,和stylus配合使用,不用计算数值,设计稿尺寸是多少,就设置为多少

License

Notifications You must be signed in to change notification settings

lydxwj/clever-rem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

聪明的响应式(rem)

1.适合移动端响应

2.配合stylus使用更佳

3.默认设计稿宽度750

4.主要使用宽度去适配,设备尺寸和比例太多,宽高都去适配会导致页面变形

import {Rem} from 'clever-rem';
Rem(750);

// import Rem from 'clever-rem';
// Rem(750);

// 两种方式都可以使用,建议在根组件中使用 750是设计稿宽度

styl文件

$REM = 1000;
rem($px) {
  $px / $REM rem;
}
.example {
    width: rem(750); // 相当于宽度占满,注意样式要初始化,去掉默认margin padding
}

About

rem响应,和stylus配合使用,不用计算数值,设计稿尺寸是多少,就设置为多少

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published