css 使用rems调整相对字体大小

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了css 使用rems调整相对字体大小相关的知识,希望对你有一定的参考价值。

/* Good practice */

html {font-size: 10px} 

/* then rem all px in your css by dividing by 10 eg. 60px= 6rem - no crazy calcs involved */


/* Best practice */

html {font-size: 62.5%}

/* use % instead of px at root. So browser default is 16, and we still want to equalize at 10. So 10/16 = .625 */

以上是关于css 使用rems调整相对字体大小的主要内容,如果未能解决你的问题,请参考以下文章