自适应布局
-
设置viewport进行缩放
-
在html中设置font-size
rem等比例,设置html的font-size
-
通过设置html的font-size属性,其中计算如下:
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-oEoUC5B7-1625537862755)(C:\Users\ASUS\AppData\Roaming\Typora\typora-user-images\image-20210705173350010.png)]
那怎么确定html的font-size呢
其中宽度为屏幕宽度,
-
在vscode设置Root Font-Size
将px转为rem
参考vscode如何将px转换为rem-站长资讯网 (info110.com)
文件——》首选项——》设置——》扩展
root font-size = 750/10 = 75
(750为设计图的宽度,10为固定系数)
没有的话,在扩展里面安装:px2rem
疑惑:font-size = 总屏幕宽度/系数,系数怎么来的
-