I am trying to change the background of a parent div when hovering over a child.
In this case the parent div background will be a gif and the children are 5 posters added dynamically.
I know i can do it with pure CSS and have tried many different solutions but none of them seem to work.
The parent background is a gif which works fine
.featured-parent {
background-image: url("/assets/images/gifs/thisGif.gif");
}
I have tried the following for the child posters.
First with ~
#poster1:hover ~ .featured-parent {
background-image: url("/assets/images/gifs/newGif.gif");
}
Second with +
#poster1:hover + .featured-parent {
background-image: url("/assets/images/gifs/newGif.gif");
}
and lastly with just a space
#poster1:hover .featured-parent {
background-image: url("/assets/images/gifs/newGif.gif");
}
I feel like the first one is the correct solution but its not working.
This is not a duplicate question, because i'm asking for any means to change the style of the parent, while hovering over the child, not necessarily by an ascendant css selector