不透明度是否在div中是不存在的

X10*_*0nD 8 css opacity

是否有可能将opacity父项的继承删除给它的孩子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>
Run Code Online (Sandbox Code Playgroud)

for*_*two 17

就像fmsf说的那样,这是不可能的.如果您正在寻找一种使背景颜色或颜色透明的方法,您可以尝试rgba.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);
}
Run Code Online (Sandbox Code Playgroud)