PDA

View Full Version : more html help. this time i want links to change colour



Peegee
10-31-2003, 11:40 AM
When you click a link, you can change its colour by setting the um...alink attribute (I think).

What about when you hover your mouse over a link? Isn't there a (javascript or style code preferably) way to do this? What is it?

Xander
10-31-2003, 01:50 PM
The CSS code is similar to for the normal link you mentioned except the word hover not link. Example:

A:hover
{ text-decoration: underline; color:#000000;


Underline can be replaced with none, overline, etc. :p Hope that helps.

The Man
10-31-2003, 05:46 PM
This is how I did the links in my signature:

<a href="http://216.97.98.128/forum/" style="color: #38E897; text-decoration: none;" :bou::bou::bou::bou::bou::bou::bou:over="this.style.color='#7EB7ED'; this.style.backgroundColor='#325681'; this.style.textDecoration='overline underline';" :bou::bou::bou::bou::bou::bou::bou:out="this.style.color='#38E897'; this.style.backgroundColor='transparent'; this.style.textDecoration='none';" onfocus="this.style.color='#A3D3FF'; this.style.backgroundColor='#5276A1'; this.style.textDecoration='overline underline';" onblur="this.style.color='#38E897'; this.style.backgroundColor='transparent'; this.style.textDecoration='none';">

etc. Really really complicated because I mucked around with a bunch of different attributes that you probably won't care about, but it works.

If you feel like mucking around with CSS, which is probably actually the best option, then do more or less what Xander said. Make sure you close your brackets though. }

You can also add "line-through" to your list of attributes under text-decoration if you want to have the struck-through effect that links at Fool's Gold have when they're activated by clicking.

Dr Unne
10-31-2003, 06:50 PM
Interestingly, you can specify :hover for tons of things other than just links. Table cells, divs, etc. CSS = good. Javascript = bad.

Flying Mullet
10-31-2003, 06:56 PM
This url is to the middle of a stylesheet tutorial and it has the link attributes and such listed: http://hotwired.lycos.com/webmonkey/98/15/index1a_page5.html?tw=authoring

If you're interested in learning about stylesheets at all this is a great tutorial to get you started.

The Man
10-31-2003, 08:31 PM
Originally posted by Dr Unne
Interestingly, you can specify :hover for tons of things other than just links. Table cells, divs, etc. CSS = good. Javascript = bad. yes, I wouldn't be using javascript in my sig if I could create my own style sheets. Alas.

Peegee
11-01-2003, 10:55 AM
Thanks everybody. I now know to call style sheets CCS (or believe I should call it CCS). Also the colours change when I hover over links

red, blue, red, blue, red, blue (gets a seizure and dies)