正准备入门移动端,看过不少文章介绍em和rem的好处,但为何天猫淘宝等大站都是用px呢?
font-size和font-family该如何写好呢
淘宝的M站是用rem的啊,字体淘宝用的是sans-serif
,也就是用系统自带默认字体。
大小的话,可以类似下面这样设置,其他样式就以html
的样式为基本。
@media only screen and (min-width: 320px){
html {
font-size: 20px !important;
}
}
@media only screen and (min-width: 640px){
html {
font-size: 40px !important;
}
}
@media only screen and (min-width: 750px){
html {
font-size: 46.875px !important;
}
}
@media only screen and (min-width: 1242px){
html {
font-size: 77.625px !important;
}
}
http://.com/q/1010000002551392?_ea=228214
多屏适配一般都是用的em