移動端媒體查詢適配px,使用rem

以375px寬度16px爲基礎

@media only screen and (min-width: 320px) {
 html {
  font-size: 13.65px !important;
 }
}

@media only screen and (min-width: 360px) {
 html {
  font-size: 15.36px !important;
 }
}

@media only screen and (min-width: 375px) {
 html {
  font-size: 16px !important;
 }
}

@media only screen and (min-width: 390px) {
 html {
  font-size: 16.64px !important;
 }
}

@media only screen and (min-width: 414px) {
 html {
  font-size: 17.664px !important;
 }
}

@media screen and (min-width: 640px) {
 html {
  font-size: 27.31px !important;
 }
}

這樣就可以在css下使用rem來進行編寫樣式。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章