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!

Hover Property on an a href ... 1

Status
Not open for further replies.

Gill1978

Programmer
Jun 12, 2001
277
GB
Hi!

I've got a specific link that i need to set the colour of the hover property on ... does anyone know how to do this?

The link code looks like this:

<a style=&quot;color:white;text-decoration:none&quot; href=&quot;projectBrowserScreen.cfm?user_id=#URL.user_id#&sort=b&quot;>Status</a>

Thanks

Julie
 
<style>
a.special:link { color:white; text-decoration:none; }
a.special:visited { color:purple }
a.special:active { background: black }
a.special:hover { color:green ; background:red; text-decoration:underline; }
</style>

<a class=&quot;special&quot; href=&quot;projectBrowserScreen.cfm?user_id=#URL.user_id#&sort=b&quot;>Status</a>

Hope this helps,
Erik
<!-- My sport: Boomerang throwing !!
This year I will participate at the World Championships in Germany. (!! Many Happy Returns !! -->
 
Erik,

I'm trying to this exact same thing but I can't seem to get it working, and I hope you (or someone) will be able to advise. For test purposes i've created this page, the code is as follows:

<HEAD>
<META NAME=&quot;GENERATOR&quot; Content=&quot;Microsoft Visual Studio 6.0&quot;>
<TITLE></TITLE>
</HEAD>
<style CLASS=&quot;Text/css&quot;>

a.Link1:link  {color: #F5F5F5}
a.Link1:hover {color: #996699}

a.Link2:link  {color: #FFFFFF}
a.Link2:hover {color: #000000}

</STYLE>

<BODY>
<A HREF=&quot;page1.htm&quot; CLASS=Link1>Link to page 1</A><BR><BR>
<A HREF=&quot;page2.htm&quot; CLASS=Link2>Link to page 2</A>
</BODY>
</HTML>

When viewing this page (through ie5.5) the links are displayed as the defult values. I really am tearing my hair out trying to work out where I'm going wrong, and any advice would be very much appreciated .
 
Ummmm,


The only thing i can see is that you've given the style tag the a class.

I've not given my style tag a class but used this and i works fine ....

<Style>

a.special:link { color:white; text-decoration:none; }
a.special:visited { color:white; text-decoration:none; }
a.special:active { background: white; text-decoration:none; }
a.special:hover { color:#ff9933 ; text-decoration:none; }
</style>

<>BODY>
<th bgcolor=&quot;#0078b3&quot;><b><cfoutput><a class=&quot;special&quot; href=&quot;projectBrowserScreen.cfm?user_id=#URL.user_id#&sort=b&quot;>Status</a></b></th></cfoutput></BODY>
 
oh and maybe you need to surround your class name in your a href's with double quotes?

<A HREF=&quot;page1.htm&quot; CLASS=&quot;Link1&quot;>Link to page 1</A><BR><BR>
 
<a id=Link1 style=&quot;color:white;text-decoration:none&quot; href=&quot;projectBrowserScreen.cfm?user_id=#URL.user_id#&sort=b&quot; onmouseover=&quot;this.style.color='red'&quot; onmouseout=&quot;this.color='white'&quot;>Status</a>
 
<a id=Link1 style=&quot;color:white;text-decoration:none&quot; href=&quot;projectBrowserScreen.cfm?user_id=#URL.user_id#&sort=b&quot; onmouseover=&quot;this.style.color='red'&quot; onmouseout=&quot;this.style.color='white'&quot;>Status</a>
 
Does you're test page look something like this?

<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>

<html>
<HEAD>

<TITLE></TITLE>
</HEAD>
<style CLASS=&quot;Text/css&quot;>

a.Link1:link {color: #F5F5F5}
a.Link1:hover {color: #996699}

a.Link2:link {color: #FFFFFF}
a.Link2:hover {color: #000000}

</STYLE>

<BODY>
<A HREF=&quot;page1.htm&quot; CLASS=Link1>Link to page 1</A><BR><BR>
<A HREF=&quot;page2.htm&quot; CLASS=Link2>Link to page 2</A>
</BODY>
</HTML>

Which shows the following on on my IE 5.5 page as

Link to page 1

Link to page 2



 
Yes, Gill1978, thats how it looks - I've tried various alternatives also, and I think sjarvee's Javascripting would work as well (thanks very much by the way, sjarvee), but I wanted to try and get this working. I'm thinking maybe its some kind of problem with my browser? (as i really can;t see the problem with the code)
 
chotchstar, check your internet options on your browser, look in the Advanced tab, there is an option in that list dealing with URL's my setting for 'underline links' is on 'always' and your code works, not sure if you have this option checked too?
 
Thanks sjarvee, I've checked the Internet Options and 'Underline links' is checked to 'always'. I seem to have got myself into a very bizzare problem, as I'm sure I've see the code as described by Gill1978 and Boomerang working before, especially if you've checked the code and its working! Thanks anyway though.
 
its best to test your page on someone elses IE55, if you experience the same problem in thier browser then the problem is almost definately in your code. If it works fine in someone elses browser (who has the same version) then do not worry too much about it, its just a browser funny.
 
its best to test your page on someone elses IE55, if you experience the same problem in thier browser then the problem is almost definately in your code. If it works fine in someone elses browser (who has the same version) then do not worry too much about it, its just a browser funny. May be you need a IE55 service pack
 
sjarvee, thanks for the advice - I now seem to have got the code working by restarting my machine (for the umpteenth time - nice!)

I also noticed a curious problem where I had an _ character in the page name on the problematic hyperlink, e.g. <A HREF=&quot;Home1_1.asp&quot;>, and this seemed to be upsetting the code, (cured by renaming the page.) This seems a bit odd to me unless I'm missing something obvious - often the case! Anyway, I'm all sorted now - thanks very much for your advice.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top