While hovering over a child element in Firefox using the rule
.parent:hover > .child { /*style*/ }
, the child element is considered separate from the parent element and does not receive styling. For example, in Firefox when you hover over the button, only the child element is affected, and not the div when it is hovered.
In Chrome, however, hovering over both the parent and child will affect the child. This behavior is useful for my current project, so I am wondering if there is a way to achieve the same effect in Firefox?
button {
position: relative;
}
button:hover > div {
background-color: #67BDFF;
}
button:hover > div:before {
content: "SMURF!";
position: absolute;
font-weight: bolder;
font-size: 20px;
top: 10px;
}
button > div {
position: absolute;
top: 18px;
left: 0;
padding: 40px;
}
<button>
hover over me and my child will turn smurf
<div>
i'll remain smurf if you over over me cus am part of my parent, but not in firefox
</div>
</button>