不透明度在一个div中是INHERITED [英] Is Opacity is INHERITED in a div
本文介绍了不透明度在一个div中是INHERITED的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以将不透明
继承从父级删除为子级 div
?
Is it possible to remove the opacity
inheritance from a parent to it's child div
?
<style type="text/css">
.parent {
opacity:.5;
}
.parent div {
opacity:1; /* I want this to override the ".5", but instead it combines */
}
</style>
<div class="parent"><div></div></div>
推荐答案
像fmsf说的,这是不可能的。
如果你正在寻找一种方法使背景颜色或颜色透明,你可以尝试rgba。这在IE6中不受支持。
Like fmsf says, it's not possible. If you're looking for a way to make background-color or color transparent, you could try rgba. This is not supported in IE6.
#my_element {
/* ie6 fallback - no opacity */
background-color:rgb(255, 255, 255);
/* rgba(red, green, blue, alpha); */
background-color:rgba(255,255,255,0.5);
}
这篇关于不透明度在一个div中是INHERITED的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文