移动端布局分享

function computedREM(){
    let HTML = document.documentElement,
        winW = HTML.clientWidth;
    HTML.style.fontSize = winW/320 * 100 + 'px';
}
computedREM();
window.addEventListener('resize',computedREM);

css中设置

html {
    font-size: 100px;
}

 

设计稿的尺寸 宽度是320,也就是初始设备宽度

 

移动端布局分享

相关文章:

  • 2021-10-08
  • 2022-02-06
  • 2022-12-23
  • 2022-12-23
  • 2022-01-01
  • 2021-12-02
猜你喜欢
  • 2021-09-23
  • 2022-12-23
  • 2021-05-09
相关资源
相似解决方案