/* 使用透明度属性 */
.transparent-element {
background-color: transparent; /* 使背景颜色完全透明 */
}
/* 使用 rgba 颜色值 */
.semi-transparent-element {
background-color: rgba(0, 0, 255, 0.5); /* 蓝色,半透明 */
}
/* 使用 opacity 属性 */
.opacity-element {
opacity: 0.5; /* 元素及其所有子元素的透明度为 50% */
}
background-color: transparent;
:将元素的背景颜色设置为完全透明。rgba(0, 0, 255, 0.5);
:使用 RGBA 颜色值,其中 0.5
表示透明度(范围是 0 到 1),这里表示半透明的蓝色。opacity: 0.5;
:将整个元素及其子元素的透明度设置为 50%,值越小越透明。上一篇:css语言
下一篇:css 背景颜色渐变
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站