I know it is an old question, but I just managed to do so without a pseudo child (but a pseudo wrapper).
If you set the parent to be with no pointer-events
, and then a child div
with pointer-events
set to auto
, it works:)
Note that <img>
tag (for example) doesn't do the trick.
Also remember to set pointer-events
to auto
for other children which have their own event listener, or otherwise they will lose their click functionality.
div.parent { _x000D_
pointer-events: none;_x000D_
}_x000D_
_x000D_
div.child {_x000D_
pointer-events: auto;_x000D_
}_x000D_
_x000D_
div.parent:hover {_x000D_
background: yellow;_x000D_
}
_x000D_
<div class="parent">_x000D_
parent - you can hover over here and it won't trigger_x000D_
<div class="child">hover over the child instead!</div>_x000D_
</div>
_x000D_
Edit:
As Shadow Wizard kindly noted: it's worth to mention this won't work for IE10 and below. (Old versions of FF and Chrome too, see here)