css覆盖没有叠加的div

时间:2015-07-29 16:25:16

标签: css overlay

我有一个带有css类的面板用于叠加,其中包含一个应该不透明的div

<asp:panel id="panelOverlay" runat="server" class="Overlay" visible="false">
        <asp:panel id="panelPopUpPanel" runat="server" class="PopUpPanel" visible="false">
            <asp:panel id="panelPopUpTitle" runat="server" style="width: 100%; height: 20px; text-align: right; ">
                <asp:imagebutton id="cmdClosePopUp" runat="server" imageurl="~/pict/graphics/delete.png"></asp:imagebutton>
            </asp:panel>
        <div class="noOverlay">
            <h4>This is the PopUp Window</h4>
            <asp:Label runat="server" ID="codice"></asp:Label>
        </div>                               
        <div>&nbsp;</div>
        </asp:panel>
    </asp:panel>

我有这个css类

.Overlay { 
          position:fixed; 
          top:0px; 
          bottom:0px; 
          left:0px; 
          right:0px; 
          overflow:hidden; 
          padding:0; 
          margin:0; 
          background-color:#000;  
          filter:alpha(opacity=50); 
          opacity:0.5; 
          z-index:1000;
        }

    .noOverlay { 
      background-color:#ffffff;  
      filter:alpha(opacity=100); 
      opacity:1; 
    }

我无法设置.noOverlay css以使其正常工作 谢谢

1 个答案:

答案 0 :(得分:0)

Cannot instantiate abstract class or interface: : com.activity.Activity. Stacktrace follows: org.hibernate.InstantiationException: Cannot instantiate abstract class or interface: : com.activity.Activity 不透明,但其父容器会导致.noOverlay显示为透明。

使用.noOverlay代替,它允许您仅为该特定元素设置背景颜色和背景透明度:

rgba
body {background:green}

.demoBox {
  background: #000;
  padding: 20px;
}
.Overlay {
  /* The last argument is the transparency from 0 to 1 */
  background: rgba(0, 0, 0, .5);
  color:#fff;
}
.noOverlay {
  background: rgba(255, 255, 255, 1);
  color:#000;
}

正如您在此处看到的那样,<div class="demoBox Overlay"> I am a transparent div <div class="demoBox noOverlay">I am not a transparent div</div> </div>包含在.noOverlay div中,但只有.Overlay是透明的。