{"id":14283,"date":"2011-09-06T20:35:52","date_gmt":"2011-09-07T03:35:52","guid":{"rendered":"http:\/\/css-tricks.com\/?page_id=14283"},"modified":"2021-07-14T12:17:35","modified_gmt":"2021-07-14T19:17:35","slug":"visited","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/almanac\/selectors\/v\/visited\/","title":{"rendered":":visited"},"content":{"rendered":"\n

The:visited<\/code> pseudo-class selector can change some<\/em> of the styling on an anchor link (<a><\/code>) element if the user’s browser has already visited the link. It’s meant to help users distinguish the difference between links they have and haven’t visited.<\/p>\n\n\n\n

a:visited {\n  color: gray;\n}<\/code><\/pre>\n\n\n

Limitations and usage<\/h3>\n\n\n

There is some privacy concern about :visited<\/code>, namely that a malicious website could have links to tons of websites with :visited<\/code> styling, then test the visual style of the links with JavaScript to report back to a server which sites the user has visited. This violates the user’s privacy and could potentially reveal personally-identifying information.<\/p>\n\n\n\n

As a result, most browsers restrict what styling can be changed on :visited<\/code> links, and what styling information can be reported with the getComputedStyle<\/code> method.<\/p>\n\n\n\n

This is a good run-down of that situation.<\/a><\/p>\n\n\n\n

These are the properties that can be changed with :visited<\/code>:<\/p>\n\n\n\n