I have some code which requires the same hover effect on every div. However, when the mouse hovers over the child, I don't want the effect to persist on the parent. I understand why it does - because when you hover over either parent or child, the mouse is still over the parent!
This example shows the problem well.
div {
background: blue;
min-width: 500px;
min-height: 90px;
margin: 40px;
color:white;
border: solid 2px white;
}
div:hover {
background: green;
}
<div>
hover here and it is green. This is great.
<div>
hover here and I'd like there to be a blue parent and this should remain as the green child
</div>
</div>
https://jsfiddle.net/5k0gaq37/8/
What I want is when the mouse hovers over the child div, the hover effect no longer affects the parent. The HTML must remain as is (although I can add another css class to any div etc), as must the existing CSS. The parent CSS could be of any style
I have tried so many ideas, it is pointless showing any as they're all so different so please excuse that I show nothing else.