这是研究了淘宝和拉钩以及网易的兼容全局样式后,提取的兼容样式,经过实战可用

css全局样式

@media screen and (max-width:321px){
body,html{font-size:15px}
}

@media screen and (min-width:321px) and (max-width:400px){
body,html{font-size:16px}
}

@media screen and (min-width:400px){
body,html{font-size:18px}
}

js全局样式
1.当设计稿是750px的时候,设置值为3.75时:
  1px=0.01rem;
全局用的时rem单位
var deviceWidth = document.documentElement.clientWidth;
if(deviceWidth > 750) deviceWidth = 750;
document.documentElement.style.fontSize = deviceWidth / 3.75+ 'px';


相关文章:

  • 2021-09-14
  • 2021-11-26
  • 2022-12-23
  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-24
  • 2021-12-12
  • 2021-12-12
  • 2021-08-20
相关资源
相似解决方案