Method One: Use the CSS3 media query to set
HTML {font-size:12px} @media screen and (min-width:480px) and (max-width:639px) {html {font-size:15px;}} @media screen and (min-width:640px) and (max-width:719px) {html {font-size:20px;}} @media screen and (min-width:720px) and (max-width:749px) {html {font-size:22.5px;}} @media screen and (min-width:750px) and (max-width:799px) {html {font-size:23.5px;}} @media screen and (min-width:800px) and (max-width:959px) {html {font-size:25px;}} @media screen and (min-width:960px) and (max-width:1079px) {html {font-size:30px;}} @media screen and (min-width:1080px) {html {font-size:32px;}}
Method Two: Use JS to set
/*
12 is the minimum font size
40 is the maximum font size
320 screen under Font-size is 12
*/
document.getElementsByTagName (' HTML ') [0].style.fontsize = Math.min (window.innerwidth*12/320,40) + "px";
How to set (control) the font size of the mobile side