Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Link Rollover w/ CSS 2

Status
Not open for further replies.

WhiteTiger

Programmer
Jun 26, 2001
605
US
How can I make a rollover link so all links change color when I hover over them? When life gives you lemons...throw them back and get the oranges you ordered! :-Q
 
Hi,
this should works in NS6 and IE4+,

<style>
.MyLink
{
FONT-FAMILY: Verdana;
TEXT-DECORATION: none;
}

.MyLink:hover
{
FONT-FAMILY: Verdana;
TEXT-DECORATION: underline;
}
</style>

<a href=&quot;&quot; class=&quot;MyLink&quot;>HERE</a>

hope this helps,
Chiu Chan
WebMaster & Software Engineer
emagine solutions, inc
cchan@emagine-solutions.com
 
Hey there,

I think rather than text decoration the attribute you're looking for is 'hover'.

In your CSS or inline style or however you choose to implement it you should add something like this:

A:hover {color: red}

This would make your links turn red when the mouse is over them.

Oh, hang on, just re-read PepperPepsi's post and he's pretty much on the money.
 
Hi,

Works great with a real browser, but how can it work with NS4?

Thanks.
 
hie here is some workaround for nn4
hover for netscape:
<html>
<head>

<style type=&quot;text/css&quot;>
A.over:link { color: red; }
A.over:visited { color: red; }
A.over:active { color: red; }

A.regular:link { color: green; }
A.regular:visited { color: green; }
A.regular:active { color: green; }
</style>

<script language=&quot;javascript&quot;>
function over(letter){
document.layers[letter+&quot;Top&quot;].document.layers[letter].visibility='hide';
}

function out(letter){
document.layers[letter+&quot;Top&quot;].document.layers[letter].visibility='show';
}
</script>

</head>
<body>
<table width=100% height=100%>
<tr align=center>
<td width=50%></td>
<td align=center>
<ilayer id=&quot;aTop&quot; left=100>
<layer><a href=&quot;somepage.html&quot; class=&quot;over&quot; onmouseout=&quot;out('a')&quot;>Link</a></layer>
<layer id=&quot;a&quot;><a href=&quot;somepage.html&quot; class=&quot;regular&quot; onmouseover=&quot;over('a')&quot;>Link</a></layer>
</ilayer>
</td>
</tr>
<tr align=center>
<td>
<ilayer id=&quot;pTop&quot;>
<layer><a href=&quot;somepage.html&quot; class=&quot;over&quot; onmouseout=&quot;out('p')&quot;>Link</a></layer>
<layer id=&quot;p&quot;><a href=&quot;somepage.html&quot; class=&quot;regular&quot; onmouseover=&quot;over('p')&quot;>Link</a></layer>
</ilayer>
</td>
</tr>
<tr align=center>
<td>
<ilayer id=&quot;fTop&quot;>
<layer><a href=&quot;somepage.html&quot; class=&quot;over&quot; onmouseout=&quot;out('f')&quot;>Link</a></layer>
<layer id=&quot;f&quot;><a href=&quot;somepage.html&quot; class=&quot;regular&quot; onmouseover=&quot;over('f')&quot;>Link</a></layer>
</ilayer>
</td>
</tr>
</table>
</body>
</html>
regards, vic
 
Thanks, but who needs NN anyways?...LOL

Everyone that comes to my site will use Internet Explorer 5...or else! When life gives you lemons...throw them back and get the oranges you ordered! :-Q
 
Hi,

Thanks Vic, it works! Now I have to evaluate if it's worth putting on all my pages for less than 20% of visitors... my guess is that it's not.

Bye.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top