css代码
* {
margin: 0;
padding: 0;
-webkit-overflow-scrolling: touch;
-webkit-tap-highlight-color: transparent;
-webkit-touch-callout: none;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
outline: none;
font-size: 0.6rem;
}
html {
font-family: arial;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
width: 100%;
height: 100%;
font-size: 20px;
}
js代码
var scWid = document.documentElement.offsetWidth||document.body.offsetWidth;
var initScWid = 375;
var initFontSize = 20;
$('html').css({
'fontSize': parseInt((scWid * initFontSize) / initScWid) + 'px'
});