css黑色透明背景,怎么做成这种半透明的背景?求代码,急急急!!!

2025-03-06 20:45:20
推荐回答(3个)
回答1:

background-color:rgba(0,0,0,0.5);

回答2:




test

.layer{
    background: #000;
opacity: 0.42; /*透明度设置样式*/
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index:1;
}
.container{
position:relative;
width:100%;
height:100%;
color:green;
font-size:48px;
z-index:0;
}
.pop{
position:relative;
margin:auto;
z-index:2;
width:400px;
height:200px;
background:#fff;
color:red;
}





this is layer


this is pop




回答3:

添加个opacity:0.8;试试

相关问答
最新问答