CSS 实现背景透明度 90% 的五种方法
- 使用 rgba 颜色值实现背景透明度 90%:
div {
background-color: rgba(255, 255, 255, 0.9);
}
- 使用 opacity 属性实现背景透明度 90%:
div {
background-color: white;
opacity: 0.9;
}
- 使用伪元素实现背景透明度 90%:
div {
position: relative;
background-color: white;
}
div::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: white;
opacity: 0.9;
z-index: -1;
}
- 使用 background 属性实现背景透明度 90%:
div {
background: rgba(255, 255, 255, 0.9);
}
- 使用 CSS3 的 backdrop-filter 实现背景透明度 90%:
div {
background-color: white;
backdrop-filter: blur(10px) opacity(0.9);
}
原文地址: https://www.cveoy.top/t/topic/neLt 著作权归作者所有。请勿转载和采集!