Forum Moderators: open

Message Too Old, No Replies

CSS for Active Link

does a:active work

         

kunwarbs

7:11 am on Dec 27, 2007 (gmt 0)

10+ Year Member



I want to add a different style to the active link but a:active doesn't work..any options?

Tastatura

8:26 am on Dec 27, 2007 (gmt 0)

10+ Year Member



I want to add a different style to the active link but a:active doesn't work..any options?

:)) you have to provide a little more information when you ask a question like that. There are bunch of knowledgeable people on this forum, but non are mind readers (not to my knowledge at least). This is akin to telling someone " Send me some information please" but you don't provide e-mail, tel, address or any other contact info, yet you expect that requested material be sent to you.

Ok, back to css....
There might be many reasons why 'styling' is not working. When in doubt go to spec:

[w3.org...]

you can also validate your css (report will point point out where the errors might be):
[jigsaw.w3.org...]

Not sure which version of CSS you are working with but this should work on any:


A:link { color: blue } /* unvisited link */
A:visited { color: red } /* visited links */
A:active { color: lime } /* active links */

[w3.org...]
an example of common mistake

...a style sheet can legally specify that the 'font-size' of an 'active' link should be larger than a 'visited' link, but the UA is not required to dynamically reformat the document when the reader selects the 'visited' link

If you read through specs, tried to validate you css and still can't figure it out, post again with your css code.

HTH

[edited by: Tastatura at 8:29 am (utc) on Dec. 27, 2007]

penders

10:15 am on Dec 27, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I want to add a different style to the active link but a:active doesn't work..any options?

You may be getting mixed up with what the :active pseudo class actually is? From Tastatura's W3C link above:

W3C: An 'active' link is one that is currently being selected (e.g. by a mouse button press) by the reader.

ie. It doesn't stay 'active' when focus moves off it. If I remember correctly you might also need to style a:focus for a cross-browser (ie. in Firefox) effect (?)