利用sass加實時監聽編譯CSS。 可自動將px轉換爲rem
SASS函數:(使用時直接調用函數)
@function torem($px){//$px爲需要轉換的字號
@return $px / 100px * 1rem; //100px爲根字體大小
}
.first{
font-size:torem(100px);
height:torem(10px);
width:torem(200px);
}
編譯後:
.first{
font-size:1rem;
height:.1rem;
width:2rem;
}
轉自:https://blog.csdn.net/dx18520548758/article/details/79614507