0

I do not want a child element to inherit parent opacity. [enter link description here][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}
Manish Basdeo
  • 5,957
  • 21
  • 67
  • 100

2 Answers2

2

Child elements must inherit the parent's opacity setting.

The only solution that I am aware of is to have the element that normally would be the child to actually be a sibling element that is positioned to seem like it was a child element.

rg88
  • 20,246
  • 18
  • 72
  • 109
1

You can't, this is because you're making transparent something, if another something is inside it, it will be transparent too!

Anyway, this is a repeated question: I do not want to inherit the child opacity from the parent in CSS

Community
  • 1
  • 1
martriay
  • 5,392
  • 3
  • 26
  • 37