html - 重置具有一定不透明度的元素的子元素的不透明度

标签 html css

<分区>

我不希望子元素继承父元素的不透明度。 [在此处输入链接描述][1]

[1]: http://jsfiddle.net/xALAW/ jsfiddle

<html>

    <head></head>
    <body>

        <div class='hasopacity'>
            This is the text with some opacity
            <div class='noopacity'>
                This is the text with no opacity 
            </div>
        </div>
</body>

CSS

.hasopacity{opacity:0.5}
.noopacity{opacity:1}

最佳答案

子元素必须继承父元素的不透明度设置。

我知道的唯一解决方案是让通常是子元素的元素实际上成为一个兄弟元素,其定位看起来像是一个子元素。

关于html - 重置具有一定不透明度的元素的子元素的不透明度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15038488/

上一篇:html - 有没有理由不将主 css 文件嵌入到网页中?

下一篇:asp.net - 将按钮顶部对齐

相关文章:

html - IE9 Facebook 点赞按钮 红色

css - "Resting"& 在 Sass 中

javascript - 我可以在淡入/淡出 JQuery 函数中使用 <a> 标签按钮类吗?

android - 在 Android(模拟器)上使用 Google Chrome 开发工具

css - 防止渐进式(逐行)加载背景图像

html - 在 div 中垂直对齐

html - Div 在桌面上显示为表格,但想要堆叠 div 以实现响应式设计

html - Bootstrap 导航栏中的下拉菜单

html - 图片在 iPhone 上的 Safari 中不显示

html - 如何使用 CSS 创建标题编号