rem实现移动端的适配

1.vsCode安装 px转rem的插件cssrem

2.页面所有内容有一个class为body-container的根块元素,设置版心的样式

.body-container{
            min-width: 320px;
            max-width: 930px;
            width: 10rem;
            position: relative;
        }

3.移动端对平度宽度在930以上的字体大小处理

@media screen and (min-width:930px) {
            html{
                font-size: 93px!important;
            }
        }

4.将需要修改的px单位置为rem单位(安装插件之后会有提示)

猜你喜欢

转载自blog.csdn.net/qq_45079530/article/details/123717984