乐趣区

关于前端:rem的使用

<script>

!function(n){

 var e=n.document,

 t=e.documentElement,

 i=750,

 d=i/100,

 o="orientationchange"in n?"orientationchange":"resize",

 a=function(){var n=t.clientWidth||320;n>750&&(n=750);

 t.style.fontSize=n/d+"px"

 };

 e.addEventListener&&(n.addEventListener(o,a,!1),e.addEventListener("DOMContentLoaded",a,!1))

}(window);

</script>

<style>

 .aaa{padding: .20rem;}

</style>

</head>

<body>

<div id="box">

 <div class="aaa">1</div>

</div>

</body>
退出移动版