0

The img opacity is interrupted by the opacity of the parent div. How to prevent this?

<div class="parent_div" style="opacity:0.2">
  <p>Some text</p>  
  <img class="gif" style="opacity: 1;" src="https://thumbs.gfycat.com/InsistentTautGodwit-size_restricted.gif"></div>
Alex Antipov
  • 123
  • 4

1 Answers1

1

Set the color on the text using rgba instead as opacity is inherited.

<div class="parent_div" style="color: rgba(0,0,0,0.2)">
  <p>Some text</p>
  <img class="gif" style="opacity: 1;" src="https://thumbs.gfycat.com/InsistentTautGodwit-size_restricted.gif"></div>
j08691
  • 204,283
  • 31
  • 260
  • 272