使用css时,子div的不透明度是否可以高于父div?
我在页面主体上有一个背景,这是我想通过第一级div显示的图像,但不是第二级div使用css时,子div的不透明度是否可以高于父div?,css,opacity,Css,Opacity,我在页面主体上有一个背景,这是我想通过第一级div显示的图像,但不是第二级div <body> <div style='opacity:0.9;'><p>This is a wrapper that shows some of the background</p> <div style='background-color:#fff;'><p>This is a child div that I
<body>
<div style='opacity:0.9;'><p>This is a wrapper that shows some of the background</p>
<div style='background-color:#fff;'><p>This is a child div that I want to be all white</p>
</div>
</div>
</body>
这是一个显示一些背景的包装器
这是一个我想要全白的儿童版
很明显,第二级div也会选择.9的不透明度。有没有办法覆盖它?以下任何一项都应该让您开始:
嗨,你可以这样做 您可以定义父城市 和你一样的孩子 前 css
.parent{
padding:20px;
background:rgba(112,81,246,0.3);
}
.child{
padding:20px;
background:rgba(112,81,246,0.6);
}
HTML
<div class="parent">
<div class="child">Hello i m child</div>
</div>
你好,我是孩子
这里有现场演示这应该会有所帮助。简单的答案是否定的:你需要找到解决方法。可能的重复