I can't remove underlining from visited links. In my computer, the Fiddle below shows black, underlined text for the visited link in any browser (current versions of Chrome, Firefox and IE).
a:link { color: red; text-decoration: underline; }
a:visited { color: black; text-decoration: none; }
<p><a href="http://www.nevervisited.com">This link is not visited.</a></p>
<p><a href="http://www.google.com">This is link is visited.</a></p>
This is Chrome's inspector for the visited link.
I suspect a:visited
being grayed out has something to do with this, but this question about grayed out styles didn't do anything for me, though it helped many others.
These answers (this, this) suggest the spec doesn't care about child elements' text-decoration
when their ancestor has it defined, but I don't think this is the case here. My <a>
s don't have underlined parents, nor am I using pseudo-elements, but pseudo-classes.
Also, why does Chrome apply a:link
to the visited link, if W3C says that
The two states [
a:link
anda:visited
] are mutually exclusive.
Maybe this has to do with user agents hiding private info from websites, like W3C suggests right after the previous quote? This:
Note. It is possible for style sheet authors to abuse the
:link
and:visited
pseudo-classes to determine which sites a user has visited without the user's consent.UAs may therefore treat all links as unvisited links, or implement other measures to preserve the user's privacy while rendering visited and unvisited links differently.