Grow your CSS skills. Land your dream job.

:visited

Last updated on:

:visited is a pseudo class selector used for anchor link elements that matches when the href attribute of that anchor link has been visited in the past by this browser. It is meant to be useful feedback for a user, so they can tell the difference between links they have been to and links they have not.

Security

There have been some security concerns about :visited, namely that a malicious website could have links to tons and tons of websites and have :visited styling, then test the visual style of the links with JavaScript and report back to a server which of these sites the user has visited. This violates the privacy of the user, as they would have no idea this is being done. As a result, many browsers restrict what styling can be done to :visited links and what styling information can be reported.

This is a good run-down of that situation.

Limited Styling

As part of that security stuff, there are limits to what kind of styling a visited link can get. Specifically:

  • color
  • background-color
  • border-color (and its sub-properties)
  • outline-color
  • The color parts of the fill and stroke properties

Leave a Comment

Posting Code

Markdown is supported in the comment area, so you can write inline code in backticks like `this` or multiline blocks of code in in triple backtick fences like ```this```. You don't need to escape code in backticks, Markdown does that for you.

Sadly, it's kind of broken. WordPress only accepts a subset of HTML in comments, which makes sense, because certainly some HTML can't be allowed, like <script> tags. But this stripping happens before the comment is processed by Markdown (via Jetpack). It seems to me that would be reversed, because after Markdown processes code in backticks, it's escaped, thus safe. If you think you can fix this issue, get in touch!

If you need to make sure the code (typically HTML) you post absolutely posts correctly, escape it and put it within <pre><code> tags.

Current ye@r *

*May or may not contain any actual "CSS" or "Tricks".