Previous Message
Next Message

Hover on div

Sent by Chris Heilmann on 24 November 2004 17:05


> Hi,
>
> Is this correct html + css ? :
>
> <style>
> div.div_href:hover {
> 	color:#990000;
> 	background: whitesmoke;
> }
> </style>
>
> <a href="test.htm">
> 	<div class="div_href">
> 		Test
> 	</div>
> </a>
>
> If yes, why doesn't it work on IE6 ?
> If not, why does it work on Mozilla ?

No it is not and no, because IE does not support :hover on any other
element but links. You cannot nest a block element(div) inside an inline
element(a).

Mozilla supports :hover though, that is why it works.

To make it work for both, simply nest the link inside the DIV and set it
to display:block. That does it.

-- 
Chris Heilmann
http://icant.co.uk/ | http://www.onlinetools.org/

______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread: