Thomas
Thomas

Reputation: 191

Styling the :visited pseudo element

Which styles can I apply to a :visited link? It seems only color is working.

I understand the privacy issue. Is there a non invasive way of styling :visited links?

Upvotes: 2

Views: 287

Answers (2)

Soufiane Hassou
Soufiane Hassou

Reputation: 17750

You will still be able to visually style visited links, but there are now limits on what styles you can use. Only the following properties can be applied to visited links:

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

MDC - Privacy and the :visited selector

Upvotes: 6

mu is too short
mu is too short

Reputation: 434665

Both CSS3 and CSS2 have this to say:

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.

So, according the standards, you can't really depend on styling a:visited at all. My experience is that all the browsers will pay attention to the coloring properties (as noted by Soufiane Hassou for Gecko browsers) but little else.

Upvotes: 5

Related Questions