我有一个div(id = alertPanel),我想把它放在另一个div(id = captchaPanel)前面。 captchaPanel div的不透明度为.25 - 但我希望前警告DIV tp是100%不透明的。 (我想要一个类似灯箱的效果)。两个DIV都有ID,不在类中。我为后面的div指定了不透明度为.25而前面的div为1的不透明度 - 但前面的div仍然不是不透明的(至少在Chrome和Safari中......在FF和IE中也很可能)。我在一个简单的CSS应用程序中制作一个特定于ID的规则,所以我很困惑为什么我得到这个结果。
这是HTML:
<div id='captchaPanel'>
<div id='alertPanel'>
in the middle
</div>
//some HTML
</div>
这是CSS:
#alertPanel
{
height: 10%;
width: 10%;
margin-left: auto ;
z-index:1;
margin-right: auto ;
position: absolute;
background-color:blue;
float:none;
opacity:1 !important;
}
#captchaPanel
{
height: 60%;
width: 57%;
background-color:#580200;
vertical-align:middle;
margin-left: auto ;
margin-right: auto ;
border-radius:15px;
opacity:.05;
z-index:-1;
}