移动端设置适配font-size
根据屏幕的大小设置不同的根节点font-size,开发时即使用rem来使其达到自适应
@media screen and (min-width:287px) and (max-width:320px) {
html {
font-size: 10px !important
}
}
@media screen and (min-width:321px) and (max-width:375px) {
html {
font-size: 11px !important
}
}
@media screen and (min-width:376px) and (max-width:414px) {
html {
font-size: 12px !important
}
}
@media screen and (min-width:415px) 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) {
html {
font-size: 25px
}
}