1,105,399 Community Members

change the colour of visited link with a:visited{}

Member Avatar
Violet_82
Veteran Poster
1,002 posts since Jan 2010
Reputation Points: 14 [?]
Q&As Helped to Solve: 6 [?]
Skill Endorsements: 8 [?]
 
0
 

HI all, I have a question about changing the colour of visited link with a:visited{}: it doestn' seem to work the way I thought it would, or, more likely I am doing something wrong.
I have this situation:

.box1 a:link{
    color:#ac2973;
    text-decoration:none;
}
.box1 a:visited{
    color:#6bb8c0;
}
.box1 a:hover{
    color:black;
}

But I have more than 1 link in the div. Now, when I click on one of the link, all of them - even those on other divs - change the colour to be #6bb8c0 even if I haven't visited them. Is this normal?
thanks

Member Avatar
pritaeas
mod_pritaeas
11,315 posts since Jul 2006
Reputation Points: 1,420 [?]
Q&As Helped to Solve: 1,835 [?]
Skill Endorsements: 156 [?]
Moderator
Featured
Sponsor
 
0
 

Do those links point to the same page?

Member Avatar
Violet_82
Veteran Poster
1,002 posts since Jan 2010
Reputation Points: 14 [?]
Q&As Helped to Solve: 6 [?]
Skill Endorsements: 8 [?]
 
0
 

ah! yes they do, the html is actually the same for all the links at the moment in that it points to #:
...<a href="#" class...
Didn't occur to me that could be the cause. So once I insert the right url it will work correct?
thanks

Member Avatar
JorgeM
IT Addict
6,417 posts since Dec 2011
Reputation Points: 581 [?]
Q&As Helped to Solve: 963 [?]
Skill Endorsements: 172 [?]
Moderator
Featured
Sponsor
 
0
 

Once you insert the correct URLs, they color will change once the visitor has visted each particular link from the browser's perspective. Of course, if the user clears their history, the links would have the a:link style applied once again.

Member Avatar
Violet_82
Veteran Poster
1,002 posts since Jan 2010
Reputation Points: 14 [?]
Q&As Helped to Solve: 6 [?]
Skill Endorsements: 8 [?]
 
0
 

ah ok thanks guys. Is that because the target is the same and once a link is clicked effectively the target site become "visited" for all the links? Just trying to find an explanation
thanks

Member Avatar
pritaeas
mod_pritaeas
11,315 posts since Jul 2006
Reputation Points: 1,420 [?]
Q&As Helped to Solve: 1,835 [?]
Skill Endorsements: 156 [?]
Moderator
Featured
Sponsor
 
0
 

Is that because the target is the same and once a link is clicked effectively the target site become "visited" for all the links?

Correct.

Question Answered as of 1 Year Ago by pritaeas and JorgeM
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article