(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);
@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;
}
}