手机端适配 rem单位

	//使用rem
		var clientWidth = document.documentElement.clientWidth;
		if(clientWidth>=640){
			document.documentElement.style.fontSize = '100px';
		}else{
			document.documentElement.style.fontSize = innerWidth/7.2 +"px";
			window.addEventListener("resize",function()                    
            {document.documentElement.style.fontSize = innerWidth/7.2  + "px"; },false)
		}
body{
margin: 0 auto;
max-width: 640px;
min-width: 320px;
}

 

你可能感兴趣的:(移动端要点)