美文网首页
微信小程序:背景图片透明处理(采用CSS/wxss)

微信小程序:背景图片透明处理(采用CSS/wxss)

作者: 我的小小笔尖 | 来源:发表于2022-06-10 19:46 被阅读0次
图片透明可以用 opacity

例如:

image: {opacity: 0.5;}

其中0.5是图片透明度

如果是背景图片呢?推荐使用 linear-gradient ,不影响前端图片的透明度

例如:

style="background-image:linear-gradient(to top, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.95)),url('{{imageurl}}')"

其中0.95是背景图透明度,使用效果如下图:


背景图透明2.JPG
CSS linear-gradient() 函数介绍

https://www.runoob.com/cssref/func-linear-gradient.html

相关文章

网友评论

      本文标题:微信小程序:背景图片透明处理(采用CSS/wxss)

      本文链接:https://www.haomeiwen.com/subject/xcbbmrtx.html