获取 html 元素,然后设置字体大小:

var oHtml=document.getElementsByTagName("html")[0];
oHtml.style.fontSize=document.documentElement.clientWidth/16+"px";

 

获取屏幕的宽度的方法:

  oHtml.getBoundingClientRect().width

  document.documentElement.clientWidth

  document.body.clientWidth

  innerWidth

相关文章:

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