Understanding :hover

Here's a testcase I made for a Mozilla bug:

<html>
<head>
<title>Img Hover Test</title>
<style>
        img { border: thick solid red }
        img:hover { border: thick solid blue }
</style>
</head>
<body>
<p>
Hello<img src="http://www.mozilla.org/images/mozilla-banner.gif">
</p>

<p><a href="http://www.mozilla.org/">
World<img src="http://www.mozilla.org/images/mozilla-banner.gif">
</a>
</p>

</body>
</html>

(also available here: http://bugzilla.mozilla.org/showattachment.cgi?attach_id=37800)

Try it in a Mozilla build (since it seems IE still doesn't support :hover)
What's weird about it is the upper image works how I'd expect, but the
lower one (the one inside the <a> element) doesn't react to the mouseover.

Why is that? Someone posted to the bug and suggested it was correct
behaviour, but I can't for the life of me see why that would be the
case. Why would it being inside an <a> prevent the hover effect from working?


-- 
AndyT (lordpixel)

Received on Wednesday, 4 July 2001 23:36:39 UTC