gpt4 book ai didi

css - Overlay 和 Box 不透明度冲突

转载 作者:太空宇宙 更新时间:2023-11-04 15:54:40 24 4
gpt4 key购买 nike

使用此代码块创建叠加层和框。

问题:盒子继承了父级的不透明度,我希望它没有透明度。

#overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #000;
filter:alpha(opacity=50);
-moz-opacity:0.5;
-khtml-opacity: 0.5;
opacity: 0.5;
z-index: 10000;
text-align: center;
}

#formed{
background-color: white;
width:300px;
height:200px;
position:relative;
left:50%;
top:50%;
margin:-100px 0 0 -150px;
}

<div id="overlay"><div id="formed">Enter Here</div></div>

最佳答案

不幸的是,这就是它的工作方式。对于父 div,您可以尝试使用 RGBA 作为背景色 - background: rgba(0, 0, 0, 0.5); http://css-tricks.com/rgba-browser-support/

关于css - Overlay 和 Box 不透明度冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10707217/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com