覆盖主CSS

问题描述 投票:0回答:1

我试图让“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;
  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;
  }
html css opacity
1个回答
1
投票

当父元素具有调整后的opacity时,您无法使子元素“更加可见”。

opacity的值范围从0到1,属性堆栈。在下面的示例中,<p>元素的“实际”不透明度不是0.5,而是0.8 * 0.5 = 0.4:

.transbox   { opacity: 0.8; }
.transbox p { opacity: 0.5; }
© www.soinside.com 2019 - 2024. All rights reserved.