How to make link not change color after visited?
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!
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;
}
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;
}
Simply give it a css color
like :
a
{
color:red;
}
For application on all the anchor tags, use
CSS
a:visited{
color:blue;
}
For application on only some of the anchor tags, use
CSS
.linkcolor a:visited{
color:blue;
}
HTML
<span class="linkcolor"><a href="http://stackoverflow.com/" target="_blank">Go to Home</a></span>
you can use a diferent class:
like
.clase
{
text-decoration-color: none;
color: #682864;
text-decoration: none;
}
.clase2:hover
{
color: white;
text-decoration: none;
}
<a href="#" class="clase2 clase"> link que no tiene subrayado ni color standar</a>