Html 覆盖主CSS
我试图使“div.transbox表”不具有“div.transbox”的不透明度 如果我试图从主transbox CSS中删除该表,则无法使该表位于“div.transbox”的顶部 非常感谢您的帮助Html 覆盖主CSS,html,css,opacity,Html,Css,Opacity,我试图使“div.transbox表”不具有“div.transbox”的不透明度 如果我试图从主transbox CSS中删除该表,则无法使该表位于“div.transbox”的顶部 非常感谢您的帮助 div.transbox { width:1000px; height:1500px; margin-left: auto; margin-right: auto; background-color:#ffffff; border:1px solid black;
div.transbox
{
width:1000px;
height:1500px;
margin-left: auto;
margin-right: auto;
background-color:#ffffff;
border:1px solid black;
opacity:0.8;
z-index:-1;
filter:alpha(opacity=80); /* For IE8 and earlier */
}
div.transbox p
{
margin:30px 40px;
font-weight:bold;
color:#000000;
z-index:-1;
}
div.transbox table
{
margin:30px 40px;
font-weight:bold;
color:black;
background-color:#cccccc;
z-index:99;
}
当父元素具有调整后的
不透明度时,不能使子元素“更可见”
不透明度
的值范围为0到1,属性堆栈。在下面的示例中,
元素的“真实”不透明度不是0.5,而是0.8*0.5=0.4:
.transbox { opacity: 0.8; }
.transbox p { opacity: 0.5; }
好的,谢谢你的澄清。如果我把它从transbox css中分离出来,我怎样才能让它保持原来的位置?@Samuelofc Addposition:relative
到.transbox
,并使用位置:绝对来绝对定位p
元素;排名:0;左:0;宽度:;高度:…
,其中…
是元素的宽度和高度。不过,还有更好的解决方案。例如,现代浏览器支持半透明颜色。请创建一个浏览器,以便我们可以尝试一些解决方案。