针对以rem为单位的项目,计算html的font-size ,

// 计算html的font-size  
(function(){ 
function resizeBaseFontSize(){
var rootHtml = document.documentElement,
deviceWidth
= rootHtml.clientWidth;
if(deviceWidth > 640){
deviceWidth
= 640;
}
rootHtml.style.fontSize
= deviceWidth / 7.5 + "px";
} resizeBaseFontSize(); window.addEventListener(
"resize", resizeBaseFontSize, false); window.addEventListener("orientationchange", resizeBaseFontSize, false); })();

相关文章:

  • 2021-08-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-11
  • 2022-12-23
  • 2022-12-23
  • 2022-01-27
猜你喜欢
  • 2021-06-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-07
  • 2021-12-11
  • 2022-12-23
相关资源
相似解决方案