2011-02-06 68 views
1

我有一个气泡形状的div。下面是代码:使div变透明,但保持边框可见

<div class="dragThis" id="dragThis"> 
     <div class="content" id="content"> 
      <p> 
       <asp:Label ID="lblContent" runat="server" Text="Label"></asp:Label> 
      </p> 
     </div> 
     <div class="pointer"> 
      <div class="one"> 
      </div> 
      <div class="two"> 
      </div> 
     </div> 
    </div> 

这里是CSS:

<style type="text/css"> 



     .dragThis 
     { 
      width: 400px; 
      color: #efefef; 
      position: absolute; 
     } 
     .pointer 
     { 
      -moz-opacity: 0.5; 
      -khtml-opacity: 0.5; 
      filter: alpha(opacity=50); 
      height: 560px; 
     } 
     .dragThis .pointer 
     { 
      height: 35px; 
      background: #393939; 
     } 
     .dragThis .pointer div 
     { 
      height: 100%; 
      background: #ffffff; 
     } 
     .dragThis .pointer .one 
     { 
      width: 50%; 
      -moz-border-radius-topright: 35px; 
      -webkit-border-top-right-radius: 35px; 
      float: left; 
     } 
     .dragThis .pointer .two 
     { 
      width: 50%; 
      float: right; 
      -moz-border-radius-topleft: 35px; 
      -webkit-border-top-left-radius: 35px; 
     } 
     .dragThis .content 
     { 
      padding: 10px; 
      -moz-border-radius: 10px; 
      -webkit-border-radius: 10px; 
      background: #393939; 
      text-align: center; 
     } 
    </style> 

这里的问题是,你可以看到,语音泡沫的下部是50%可见。我希望黑色部分可以显示为100,而其他部分都是透明的。

谢谢。

+0

@Downvoter - Just wow .. – Pabuc 2011-02-06 06:31:29

回答

1

一个可行的例子会很好。

你不能将不透明度分成不同的部分。但是如果你的元素没有背景,除了边界之外,它将是透明的。

0

不使用不透明度,您可以使用最后一个值为0的rgba颜色,例如rgba(255,255,255,0)。就我而言,不透明度是遗传的,但rgba值不是。