How to Make Link Not Change Color After Visited

How to make link not change color after visited?

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;
}

Disable color change of anchor tag when visited

You can't. You can only style the visited state.

For other people who find this, make sure that you have them in the right order:

a {color:#FF0000;}         /* Unvisited link  */
a:visited {color:#00FF00;} /* Visited link */
a:hover {color:#FF00FF;} /* Mouse over link */
a:active {color:#0000FF;} /* Selected link */

Link text color not changing after being visited

The :visited pseudo-class works on the browser's history. The fact that all three links are being drawn with the black colour means that your browser has visited them in the past. If you were to clear your history, or change the links' urls, you'll find that they aren't classed as 'visited'.

A link to Stack Overflow will probably show as visited in your browser, but a link to Voice of JIHAD probably shows up a different colour (unless you are a member of the Taliban). Clicking on the unvisited link will change its colour to the visited colour - as defined in Stack Overflow's stylesheets - and will remain 'visited' as long as the page exists in your browser's history.

Related Question: How to change the color of hyperlink after click it

Credit to Greg for this answer.

In CSS , visited link does not change color

Instead of using a:visited, use a:focus`.

It's proven more reliable for me as the color changes when the link receives focus, visited seems unreliable as cached visits affect it ..boo

Hope this helps

Why is the visited link color not changing when I give the absolute link in anchor tag?

Note that the css class is for visited not clicked.

So when you click on <a href="D:\MyFolder\ContactUs.html">Contact Us</a> and the browser automatically detects that it is a file, it redirects to file:///d:/MyFolder/ContactUs.html and marks that as visited, not the path you are specifying.

So as said, either change your links to have file:/// in front, or use relative links (which makes more sense)

How do I remove the default link color of the html hyperlink 'a' tag?

The inherit value:

a { color: inherit; } 

… will cause the element to take on the colour of its parent (which is what I think you are looking for).

A live demo follows:

a {
color: inherit;
}
<p>The default color of the html element is black. The default colour of the body and of a paragraph is inherited. This
<a href="http://example.com">link</a> would normally take on the default link or visited color, but has been styled to inherit the color from the paragraph.</p>

Possible to disable a:visited?

You can overwrite a:visited{...} with your own style. For example, if you want the link to stay red for unpublished visited links, then you do:

a.unpublished:visited{
color:red;
}

If you just want the anchor color to stay the same as the anchor's parent element you can use inherit:

a:visited {
color: inherit;
}


Related Topics



Leave a reply



Submit