PDA

View Full Version : rollover links



ashley_2000
06-30-2006, 07:39 PM
hello,

i am using the below code for rollover links and my links are two colors.

once clicked, is there a code that i can add, so the color RED stays the same. that way, the user will know the link has been clicked.

many thnx

<style>
<!--
a:hover{color:red}
//-->
</style>

djr33
06-30-2006, 07:51 PM
<style>
<!--
a:hover{color:red}
a:active{color:red}
a:visited{color:red}
//-->
</style>

hover- when the mouse is over, active- when the link is loading, visited- when you go back to this page and have already been to the page it links to.



That code has a few issues, though. Firstly, you should have all the states assigned, with those you don't want red set to, for example, blue, or something.
(Usually links should be blue... it tells people its a link. Sometimes, inexperienced users don't even know something isn't a link if it's not blue.)

Also, "red" isn't a color in html. It works sometimes, but the real code would be #FF0000

to explain: it's RRGGBB where it's red, green, blue.
The scale goes from 0 (zero) to F... 0,1,...9,A,B,...F
The pairs will always be the same. FF44AA, never 890FA2*
(*those actually exist, and might work, but the others are the 256 web safe colors... the others will have issues in some situations/browsers/computers/etc)

Also... I'm not css expert, but I'm not sure if :color: is right... I think it might be "text-color" instead.


And, this isn't too important, but having a semi-colon as color:red;* would be helpful to stick to the standards. (*or whatever you end up using)

ashley_2000
06-30-2006, 08:00 PM
thank you very much djr. it works perfectly now. i will check with netscape and apples too. so far, when i use color names, this little script works very nicely. this is how i choose the colors: http://www.oreilly.com/catalog/wdnut/excerpt/color_names.html

thnx again!
ash

djr33
06-30-2006, 09:04 PM
Sure, the colors will work, but they aren't standard, and using the hex sytem (#FF0000) will give you a lot more flexibility.