移动端设计稿为750px*1134px:
html {
font-size: 312.5%;
}
@media screen and (max-width: 359px) and (orientation: portrait) {
html {
font-size: 266.67%;
}
}
@media screen and (min-width: 360px) and (max-width: 374px) and (orientation: portrait) {
html {
font-size: 300%;
}
}
@media screen and (min-width: 384px) and (max-width: 399px) and (orientation: portrait) {
html {
font-size: 320%;
}
}
@media screen and (min-width: 400px) and (max-width: 413px) and (orientation: portrait) {
html {
font-size: 333.33%;
}
}
@media screen and (min-width: 414px) and (max-width: 431px) and (orientation: portrait) {
html {
font-size: 345%;
}
}
@media screen and (min-width: 432px) and (max-width: 479px) and (orientation: portrait) {
html {
font-size: 360%;
}
}
@media screen and (min-width: 480px)and (max-width: 639px) and (orientation: portrait) {
html {
font-size: 400%;
}
}
@media screen and (min-width: 640px) and (orientation: portrait) {
html {
font-size: 533.33%;
}
}
rem与px的转换为1:100,即width:100px===width:1rem
本文介绍了一种基于不同屏幕尺寸调整字体大小的移动端适配方案,通过设置不同的百分比来实现1rem等于100px的布局效果。
5651

被折叠的 条评论
为什么被折叠?



