【发布时间】:2012-12-13 04:38:50
【问题描述】:
可能重复:
I do not want to inherit the child opacity from the parent in CSS
我的页面包含以下<div>:
<div id="OffDiv">
<asp:Image ID="imgHammer" runat="server" ImageUrl="~/Images/hammer.png" ToolTip="Biding..." />
</div>
和css:
div#OffDiv
{
display: block;
position: fixed;
top: 0px;
right: 0px;
width: 100%;
height: 100%;
padding: 0px;
margin: 0px;
z-index: 90000;
background-color: Blue;
filter: alpha(opacity=40); /* internet explorer */
-khtml-opacity: 0.4; /* khtml, old safari */
-moz-opacity: 0.4; /* mozilla, netscape */
opacity: 0.4; /* fx, safari, opera */
text-align: center;
}
#imgHammer
{
margin-top: 100px;
z-index: 90001
filter: alpha(opacity=100); /* internet explorer */
-khtml-opacity: 1; /* khtml, old safari */
-moz-opacity: 1; /* mozilla, netscape */
opacity: 1; /* fx, safari, opera */
z-index: 90001;
}
问题是imgHammer 在渲染后具有像OffDiv(意思是0.4)一样的低不透明度。
如何将其不透明度更改为 1?
【问题讨论】:
-
包含 div 的不透明度将继续影响任何子元素。要么在该 div 上设置不透明度,要么从 div 中删除图像。
-
好的,我想在 offDiv 中上下滑动...所以如果我把 img 放在另一个 div 中,我如何同步 sildeUp 和 Down?