Change color of an anchor link

If you want all your links to be that colour, no matter whether they’ve been visited ot not, then you can forget about the code bluedreamer gave you; you don’t need that.

All you need is a simple line to turn all links the same colour:

a {color: #651023;}

1 Like

so erase what i did in the highlight class

galia

Yes.

hello!

now it works thank you but if i want them when i press on the links on the side to become from black to the color that now want i have to do but the color on the big table will stay what i did ( you make me think)

thanks galia

So you want the the links in apDiv4 to change colour after they’ve been clicked, but the other links to stay the same colour all the time, is that right?

You can do that by adding a rule to target only the links inside that div, and only when they’ve been visited. Like this:

#apDiv4 a:visited {color: #00FF00;}

(That turns them green; use your own choice of colour there.)

hello!

I thought that if i press the link it becomes another color but before i click is in the same color of the other links
is the same that you do?

thanks galia

If you want a link to show a different colour after it’s been clicked, you set that with a:visited. What that does is to make the link a different colour if you’ve already visited the destination. So if you have two links on your page with href=“#top”, for example, they will both change colour after you’ve clicked one of them.

Does that make sense?

To add to @TechnoBear, if you want the different color AS you click the link, then that is the :active pseudo-class

a:active{}

hello!
i look again after saving but just in explorer and not in chrome it works
i will try what say ryan

thanks galia

what to write inside the Brackets is it true to write the color and if i whant just to apdiv4 what to do?
galia

If you’ve already visited those links in one browser, the browser will “remember” that and show them as visited. Using a different browser, the links will start as “unvisited” until you click them.

hello!

ok thanks i choose what i want

galia

hello!
what to write inside the Brackets is it true to write the color and if i whant just to apdiv4 what to do?
galia

Oh, come on - you can work this out for yourself with the information you already have in this topic.

Post #25 shows you how to target only the links in apDiv4.

If you want the links to change colour as you click them, then you use a:active, not a:visited.

(And if you think you know what to change, then why not just try it and see if it works? As I said before, make a backup copy of your file, then you can test and see what happens when you try different things. You will learn more, and remember it better, by working things out for yourself. )

Just like TechnoBear said in post #25

Maybe you should read the answers a bit better.

hello!

That what i was thinking to do but i wasn’t sure i will try to do that thanks
galia

hello!

so it works thank you

galia

2 Likes