var scale= 1/ window.devicePixelRatio;
document.querySelector('meta[name='viewport']').setAttribute('content','width=device-width,initial-scale='+scale+'maximum='+scale)
document.documentElement.style.fontSize= document.documentElement.clientWidth / 10 +'px'
media查询设置初值
/* mobile media-query */
html {
font-size: 312.5%;
}
@media screen and (min-width: 360px) and (max-width: 374px) and (orientation: portrait) {
html {
font-size: 351.5%;
}
}
@media screen and (min-width: 384px) and (max-width: 399px) and (orientation: portrait) {
html {
font-size: 375%;
}
}
@media screen and (min-width: 400px) and (max-width: 413px) and (orientation: portrait) {
html {
font-size: 390.625%;
}
}
@media screen and (min-width: 414px) and (max-width: 431px) and (orientation: portrait) {
html {
font-size: 404.3%;
}
}
@media screen and (min-width: 432px) and (max-width: 479px) and (orientation: portrait) {
html {
font-size: 421.875%;
}
}
@media screen and (min-width: 480px)and (max-width: 639px) and (orientation: portrait) {
html {
font-size: 468.75%;
}
}
@media screen and (min-width: 640px) and (orientation: portrait) {
html {
font-size: 625%;
}
}