Log in

View Full Version : divs with different hover



chechu
08-01-2007, 02:16 PM
Hey guys,
How can I make sure that one div has a hover:underline, and another hover: none ? The divs are stored in a separate css file.

jc_gmk
08-01-2007, 03:53 PM
I presume you mean a:hover as IE doesn't support hover of anything else.
Unless of coarse you use some form of hack.

If so then just set the divs with differant classes e.g.



<div class="firstdiv">
<a href="anywhere.html">anylink</a>
</div>

<div class="seconddiv">
<a href="anywhere.html">anylink</a>
</div>


Then add some css e.g.

.firstdiv a { text-decoration:none; }
.firstdiv a:hover { text-decoration:underline; }

.seconddiv a { text-decoration:none; }
.seconddiv a:hover { text-decoration:none; }

alexjewell
08-01-2007, 04:18 PM
#first_div:hover{
text-decoration: underline;}

#second_div:hover{
text-decoration: none;}


Isn't supported in IE6 or below, but IE7 and standards compliant browsers support it. For IE6, you would need javascript. I'm working on a script, I'll let you know when it's done.

chechu
08-07-2007, 02:39 PM
The above doesn't work indeed...

Twey
08-07-2007, 03:28 PM
You can also use an HTC (http://www.xs4all.nl/~peterned/csshover.html) to fix this for IE<7.