1 window.onresize=function(){
2     var html=document.getElementsByTagName("html")[0];
3     var width=window.innerWidth; // 获取窗口的文档显示区的宽度
4     var font_Size=16/1920*width; // 设计稿以1920为准,在1920的设计稿中:16px = 1rem
5     html.style.fontSize=font_Size+"px";
6 };

 

相关文章:

  • 2022-12-23
  • 2021-04-26
  • 2021-12-21
  • 2021-09-04
  • 2021-08-19
  • 2022-02-17
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-13
  • 2021-11-28
  • 2021-04-04
  • 2022-01-03
  • 2022-12-23
相关资源
相似解决方案