在微信小程序中或UniApp中自定义tabbar实现毛玻璃高斯模糊效果

backdrop-filter: blur(10px); 这一行代码表示将背景进行模糊处理,模糊程度为10像素。这会导致背景内容在这个元素后面呈现模糊效果。
background-color: rgb(255 255 255 / .32); 这一行代码表示设置元素的背景颜色为白色(RGB值为0, 0, 0),并且通过/符号后面的透明度值(32%不透明度)使背景半透明。这会导致背景显示为半透明的白色。

微信小程序

当tabbar背景颜色是黑色(#000000)的时候,设置background-color: rgb(0 0 0 / .32)

css 复制代码
/* 设置tabbar背景颜色 */
background-color: #000000 !important;
/* 毛玻璃 高斯模糊 */
backdrop-filter: blur(10px) !important;
background-color: rgb(0 0 0 / .32) !important;

当tabbar背景颜色是白色(#ffffff)的时候,设置background-color: rgb(255 255 255 / .32)

css 复制代码
/* 设置tabbar背景颜色 */
background-color: #000000 !important;
/* 毛玻璃 高斯模糊 */
backdrop-filter: blur(10px) !important;
background-color: rgb(255 255 255 / .32) !important;

UniApp

与微信小程序写法类似,但是background-color需要改成

css 复制代码
/* 设置tabbar背景颜色 */
background-color: #000000 !important;
/* 毛玻璃 高斯模糊 */
backdrop-filter: blur(10px) !important;
background-color: rgba(255,255,255,.32) !important;
相关推荐
JELEE.8 小时前
原生微信小程序开发笔记
笔记·微信小程序
蓝黑20201 天前
从经纬度获取地理信息以及从地名获取经纬度
小程序
码云数智-园园1 天前
和小鹅通一样的平台有哪些
微信小程序
吴声子夜歌1 天前
小程序——逻辑层
小程序
花木偶1 天前
小迪网安:APP攻防-Day1
安全·小程序
吴声子夜歌2 天前
小程序——生命周期函数和事件处理函数
服务器·前端·小程序
hnxaoli3 天前
win10程序(十六)通达信参数清洗器
开发语言·python·小程序·股票·炒股
码云数智-大飞3 天前
自助建站系统哪个好?快速建站哪个平台好
微信小程序
吴声子夜歌3 天前
小程序——项目结构
小程序
大黄说说3 天前
微信小程序制作平台有哪些?SaaS小程序搭建平台推荐
微信小程序