rem適配 <meta name="viewport" content="width=device-width,user-scalable=no"/> <script> (function(){ var html=document.documentElement; var hWidth=html.g ...
rem適配
<meta name="viewport" content="width=device-width,user-scalable=no"/>
<script>
(function(){
var html=document.documentElement;
var hWidth=html.getBoundingClientRect().width;
html.style.fontSize=hWidth/16+"px"; //除的這個數是可以隨便的,好算就行,若是除以16(除多少都行),意味著16rem占滿整行,拿到設計圖的話,量出來的設計圖尺寸/2/html.style.fontSize就能適配
})()
</script>