vue用postcss做适配,背景图无法适应解决方法

vue做适配背景图无法适应解决方法

最近使用postcss插件做不同屏幕适配,使之看起来在任何屏幕上显示效果和设计图一样,但是运行时发现按钮的容器是根据适配改变了,但是背景图却没有缩放

这是原来的写法和效果

.f-btn,.f-btn1{
    
    width:82px;height:31px;color:#fff;}
.f-btn{
    
    
text-align:left;
background: url("../imgs/auto.png") 100% 100% no-repeat;
}

在这里插入图片描述
这是修改后的写法和效果图

.f-btn,.f-btn1{
    
    width:82px;height:31px;color:#fff;}
.f-btn{
    
    
text-align:left;
background: url("../imgs/auto.png") no-repeat;
background-size:100% 100%;
}

在这里插入图片描述
总结:之前习惯了连写background的属性,可能插件识别不了,需要把background-size单独写出来

猜你喜欢

转载自blog.csdn.net/weixin_43939111/article/details/110115021