モバイル端末remの適合を実現
399 ワード
#rem{
height: 0.5rem;
width: 0.5rem;
background-color: blueviolet;
}
*{
margin: 0;
padding: 0;
}
window.onload=function (){
var width=document.documentElement.clientWidth;
var htmlNode = document.querySelector("html");
htmlNode.style.fontSize=width+"px";
}