Change parent element style from child element with CSS

Asked

Viewed 546 times

0

Good afternoon, I wonder if you have how to change the background of the father div when the child element(img) gain mouse focus(:)

.pai{ 
        padding: 20px;
        background-color: #ffb3b3;
        display: inline-flex;
	}
    
.filho{ 
        padding: 20px;
        background-color: lightblue;
        display: inline-flex;
	}
<div class="pai">
  <img class="filho">
</div>

  • 1

    Not yet, but it is one of the Ports for css4 http://css4.rocks/

  • that is, it is not yet possible to perform this correct feat?

  • 1

    Only with css not, if wanted, I can put a solution with some javascript lines.

  • 1

    Thanks for taking the doubt, in js I can, I just wanted to know if you had with pure CSS same!

  • There yes! dispose.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.