透明父母的不透明孩子 [英] Nontransparent child in transparent parent
本文介绍了透明父母的不透明孩子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在html中有透明的div-block。里面还有另一个孩子块。是否有可能使这个孩子divs不透明?我不相信如此,但你可以做这样的事情:
< div style =position:relative>
< div style =position:absolute; top:0; left:0; opacity:0.5; z-index:2;>
< / div>
< div style =position:absolute; top:0; left:0; z-index:3;>
< p>我完全不透明< / p>
< / div>
< / div>
这项技术基本上覆盖了一个div。这对于背景图像动画和其他情况非常有用,但可能不适用于您的用例 - 您必须详细说明。
I have transparent div-block in html. There is another child blocks in it. Is it possible to make that child divs untransparent?
解决方案
I don't believe so, but you can do something like this:
<div style="position: relative">
<div style="position: absolute; top: 0; left: 0; opacity: 0.5; z-index: 2;">
</div>
<div style="position: absolute; top: 0; left: 0; z-index: 3;">
<p>I'm fully opaque</p>
</div>
</div>
This technique basically overlays one div on top of the other. It's useful for animating background images and for other situations but might not be applicable to your use case - you'll have to elaborate.
这篇关于透明父母的不透明孩子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文