css - 使 div 透明但保持边框可见

标签 css transparency

我有一个对话泡泡形状的 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 可见,其他所有部分都是透明的。

谢谢。

最佳答案

一个工作示例会很好。

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

关于css - 使 div 透明但保持边框可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4911946/

相关文章:

css - 如何选择第 1、4、7 等元素?

html - 如何制作 HTML 导航栏

html - 拆分宽度 : 100% parent container into sections with decimals? 的最佳方法是什么

flash - 如何为每个Flash对象和嵌入标签添加wmode ="transparent"?

iphone - 具有给定透明度的 UILabel 但 textLabel 应该是不透明的

java - 在具有一定透明度的 Java 中实现游标

jquery - style.display = 'none' 适用于 IE8 但不适用于 IE11

cocoa-touch - 如何在iOS 7中制作完全透明的导航栏

html - 使它下面的一切和它本身透明的形状

css - 尝试将 Png 文件用于背景包装时出现格式问题