I cannot find a way to style a:visited
but only those belonging to .extern
.
a:visited.extern
doesn't work and neither does a.extern:visited
(I' using Mozilla Firefox 43.0.1 for Linux x86_64)
The reason is I have a small icon I'd like to add to .extern
links, and I want to change its url()
when the link is visited.
<style>
a.extern {
padding-right:1.3em;
background-repeat: no-repeat;
background-attachment: scroll;
background-position: right center;
background-clip: border-box;
background-origin: padding-box;
background-size: 0.7em 0.7em;
background-image: url("img/link.png");
}
a:visited:extern {
background-image:url("img/link-visited.png");
}
a.extern:visited {
background-image:url("img/link-visited.png");
}
</style>
In the end all visited links of this type should be affected
<a class="extern" href="http://etc.etc.etc">link</a>
Basically what you want to do is restricted by browsers, particularly Firefox.
Per MDN - Privacy and the :visited selector
First, I assume the name of your class is
extern
, and not.extern
, so youra
tag will look something like this.To style only the visited links which have the extern class you should use:
Notice how the
:visited
selector is added at the end:a.extern:visited
.Change
to
and
block with code below do not needed