I'm facing an unusual CSS challenge.
Check out this simple code snippet below that showcases the issue:
<html>
<head>
<style>
.hover {
float: right;
}
.hover:hover {
background-color: blue;
}
.blocker {
opacity: 0.5;
}
</style>
</head>
<body>
<div class="hover">hover</div>
<div class="blocker">blocker</div>
</body>
</html>
I have a situation where div A is floating over another div B with an opacity of 0.5. I want to apply a CSS hover effect on the floating div. However, for some reason, it doesn't seem to work.
Changing the float direction from right to left doesn't make a difference.
Interestingly, when I increase the opacity to 1, the hover effect starts working suddenly.
Could someone shed light on why this behavior occurs?
To "solve" this issue, I can wrap the content of the blocker div in a span, but it seems unnecessary.
Feel free to view this problem in action on jsFiddle: http://jsfiddle.net/ed82z/1/