I have a pseudo class on a <label>
tag to show a check when the option has been checked. It was doing all these crazy things with positioning, throwing all of the pseudo elements into the top corner, and even showing two of the same ::after
element on hover.
I finally figured out that I had filter: brightness(.9)
on :hover
, but no filter: brightness
on the base <label>
CSS. Once I added filter: brightness(1)
to the base element, the problem vanished.
Here is a fiddle. First, hover over the check(s) in the top right corner and the blue buttons to see the issue. Then uncomment the filter: brightness(1)
line to see the fix. I made it a bit ugly so the problem would be readily visible.
But now I'm left scratching my head. What was going on? It seems like by not having the filter
on, the CSS forgot which element was the parent element and just referenced the last non-statically positioned element. Why would this happen? Are there any other cases like this?