The above example is very good, but if there is a difference between the div and you do not want the effect to work when you hover over empty space, there is no need for javascript.
Here is an easy way:
just add float:left to .child and make sure .parent has overflow:visible (it should be visible by default).
Thus .parent becomes 0px high (therefore, the effect will not work on empty space), but hovering over .child calls as a pseudo- .child :hover .
mtt
source share