Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make link not change color after visited?

Tags:

html

css

I have this css:

a:visited  {     text-decoration: none;      decoration: none;  } 

After a link is visited it changes color.

It is happening to the "Browse All Problems" link on the bottom of the right side of this page: http://www.problemio.com

Thanks!

like image 692
GeekedOut Avatar asked Nov 18 '11 19:11

GeekedOut


People also ask

How do I remove purple color from visited links?

A purple link can be removed by overriding the default link styles in CSS. Specifically, a purple link indicates that the link has already been visited. So in order to change this style we must change the CSS :visited pseudo class.

How do I remove visited link color from my browser?

Press F12 to open Chrome Developer Tools. Click on the magnifying glass on the upper left and select the visited link. Unclick the CSS rule in the Style section.


2 Answers

Text decoration affects the underline, not the color.

To set the visited color to the same as the default, try:

a {      color: blue; } 

Or

a {     text-decoration: none; } a:link, a:visited {     color: blue; } a:hover {     color: red; } 
like image 171
Matt Stauffer Avatar answered Sep 24 '22 05:09

Matt Stauffer


In order to avoid duplicate code, I recommend you to define the color once, for both states:

a, a:visited{      color: /* some color */; } 

This, indeeed, will mantain your <a> color (whatever this color is) even when the link has been visited.

Notice that, if the color of the element inside of the <a> is being inherited (e.g. the color is set in the body), you could do the following trick:

a, a:visited {     color: inherit; } 
like image 43
eversor Avatar answered Sep 22 '22 05:09

eversor