vw+rem移動端適配


html {html

   font-size: 16px;ide

}字體

@media screen and (min-width: 320px) {spa

html {htm

       /* iPhone5的320px尺寸做爲14px基準,320px正好14px大小, 375 16px */it

       font-size: calc(100% +  (100vw - 320px) / 27.5);class

       font-size: calc(14px +  (100vw - 320px) / 27.5);di

   }view

}vi

@media screen and (min-width: 375px) {

html {

       /* iPhone6的375px尺寸做爲16px基準,414px正好18px大小, 600 20px */

       font-size: calc(100% + 2 * (100vw - 375px) / 39);

       font-size: calc(16px + 2 * (100vw - 375px) / 39);

   }

}

@media screen and (min-width: 414px) {

html {

       /* 414px-1000px每100像素寬字體增長1px(18px-22px) */

       font-size: calc(112.5% + 4 * (100vw - 414px) / 586);

       font-size: calc(18px + 4 * (100vw - 414px) / 586);

   }

}

@media screen and (min-width: 600px) {

html {

       /* 600px-1000px每100像素寬字體增長1px(20px-24px) */

       font-size: calc(125% + 4 * (100vw - 600px) / 400);

       font-size: calc(20px + 4 * (100vw - 600px) / 400);

   }

}

@media screen and (min-width: 1000px) {

html {

       /* 1000px日後是每100像素0.5px增長 */

       font-size: calc(137.5% + 6 * (100vw - 1000px) / 1000);

       font-size: calc(22px + 6 * (100vw - 1000px) / 1000);

   }

}

相關文章
相關標籤/搜索