rem根据html元素font-size属性换算,浏览器默认html的font-size:16px,即1rem = 16px
假设设置屏幕宽度为7.5rem
适配750px屏幕:
html{font-size:625%}
原理:750 / 7.5 = 100,即需要设置1rem = 100px;100 / 16 = 625%;
等式 16px * 625% = 100px;
所以,设置html字体为625%;即可rem适配
最后设置需要适配的屏幕宽度@media screen,设置html字体百分比,即可适配
计算百分比公式 html百分比 = 待适配屏幕宽度/ (7.5 * 16)