媒体查询-移动端rem的字体大小设置

257 阅读1分钟
@media screen and (min-width320px) {

  html {

    font-size8.5333px !important;

  }

}


@media screen and (min-width360px) {

  html {

    font-size9.6px !important;

  }

}



@media screen and (min-width375px) {

  html {

    font-size10px !important;

  }

}


@media screen and (min-width384px) {

  html {

    font-size10.24px !important;

  }

}


@media screen and (min-width411px) {

  html {

    font-size10.96px !important;

  }

}


@media screen and (min-width414px) {

  html {

    font-size11.04px !important;

  }

}


@media screen and (min-width448px) {

  html {

    font-size11.9467px !important;

  }

}


@media screen and (min-width480px) {

  html {

    font-size12.8px !important;

  }

}


@media screen and (min-width512px) {

  html {

    font-size13.6533px !important;

  }

}


@media screen and (min-width544px) {

  html {

    font-size14.5067px !important;

  }

}


@media screen and (min-width576px) {

  html {

    font-size15.36px !important;

  }

}


@media screen and (min-width608px) {

  html {

    font-size16.2133px !important;

  }

}



@media screen and (min-width640px) {

  html {

    font-size17.0667px !important;

  }

}



@media screen and (min-width750px) {

  html {

    font-size20px !important;

  }

}


@media screen and (min-width768px) {

  html {

    font-size20.48px !important;

  }

}


@media screen and (min-width800px) {

  html {

    font-size21.3333px !important;

  }

}



@media screen and (min-width1024px) {

  html {

    font-size27.3067px !important;

  }

}

一般的设计稿宽度为375px或者750px;当设计稿为375时,此时的1rem = 10px;当设计稿为750时,此时的1rem = 20px;然后对照着设计稿上的尺寸开发就可以了。