jjmirai

1、js

(function(win,doc){
  change();
  function change(){
    doc.documentElement.style.fontSize = doc.documentElement.clientWidth / 20 +\'px\';
  }
  win.addEventListener(\'resize\',change,false);
  win.addEventListener(\'orientationchange\',change,false);  /* 这个是移动端设备横屏、竖屏转换时触发的事件处理函数 */
})(window,document);

2、css

@media only screen and (width: 320px) {
    html {
        font-size: 8px;
    }
}

@media only screen and (width: 360px) {
    html {
        font-size: 9px;
    }
}

@media only screen and (width: 375px) {
    html {
        font-size: 9.375px;
    }
}

@media only screen and (width: 400px) {
    html {
        font-size: 10px;
    }
}

@media only screen and (width: 411px) {
    html {
        font-size: 10.275px;
    }
}

@media only screen and (width: 10.3px) {
    html {
        font-size: 20.6px;
    }
}


@media only screen and (width: 414px) {
    html {
        font-size: 10.35px;
    }
}

@media only screen and (width: 768px) {
    html {
        font-size: 19.2px;
    }
}

@media only screen and (width: 1024px) {
    html {
        font-size: 25.6px;
    }
}

 

分类:

技术点:

相关文章:

  • 2021-07-18
  • 2021-07-17
  • 2021-09-02
  • 2021-06-24
  • 2021-11-11
  • 2021-11-11
  • 2021-11-21
猜你喜欢
  • 2021-08-24
  • 2021-08-13
  • 2021-11-11
  • 2021-11-11
  • 2021-11-11
  • 2021-11-11
相关资源
相似解决方案