Automatic calculation of fontsize in H5 responsive development

Time:2021-5-10
var winWidth = window.innerWidth;  
var winHeight = window.innerHeight; 
//Get the screen width REM = screen width / 7.5 + "PX"
var perRemPx = document.getElementsByTagName("html")\[0\].clientWidth / 7.5;  
  //Dynamic computing
window.addEventListener("resize", function () {  
//Get the screen width REM = screen width / 7.5 + "PX"
    perRemPx = document.getElementsByTagName("html")\[0\].clientWidth / 7.5;  
     //Copy the REM value to the font size of the root element
  document.getElementsByTagName("html")\[0\].style.fontSize \= perRemPx + "px";  
});  
//Copy the REM value to the font size of the root element
document.getElementsByTagName("html")\[0\].style.fontSize \= perRemPx + "px";