Your code is correct according to most specifications. However, many browsers view background images on visited links as a potential violation of user privacy, so they do not allow this.
Check out this example:
<p><a href="/unvisited">Unvisited link</a></p> <p><a href="http://jsfiddle.net/">Visited Link</a></p> <style> a { background:red url("http://placekitten.com/100/101?image=2") center center no-repeat; display: block; height: 200px; width: 200px; overflow: hidden; text-align: center; background-color: red; } a:visited { background:blue url("http://placekitten.com/100/100?image=1") center center no-repeat; } </style>
(Also at http://jsfiddle.net/Yq5GY/1/ ). Firefox ignores the background image ad for visited links and never displays a solo kitten. You can make some differences with the background color. In any case, this is a bad use to rely on images.
source share