2 Replies - 365 Views - Last Post: 28 April 2011 - 10:38 PM

#1 Calicode  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 26-July 08

Certain Pseudo Classes Don't Stack?

Posted 28 April 2011 - 02:01 PM

Earlier today, during a bit of downtime, it occurred to me that I could style my links far more actively than I had been previously. I decided I wanted to use the content property, and that I wanted to style only visited links.

Naturally, my syntax was simple enough:

a:visited:before{
content:"o";
}



The code, to my surprise, did not work. (I used something other than 'o', naturally, but nothing at all worked.)

A bit of research found that exact syntax on several blogs from many years ago, and I was surprised to find that -none- of the demonstrations posted worked. They all had comments congratulating them on their code, and so I can't just assume that the code itself is flawed.

a:active:before works.
a:hover:before works.
a:link:before works.

a:visited:before does not work.

I've tried this on several browers, including IE7, IE8, Firefox 4, Safari, and Chrome. None of them display the a:visited:before code properly, even after I've visited the link in that session to be doubly sure. a:visited styling works properly, so again, it is not the :visited selector or :before selector that do not work.

Does anyone know why this might be an issue and what can be done to resolve it (other than apply a padding / background image to the a:visited links, I'd rather solve this really strange issue than go around it).

Is This A Good Question/Topic? 0
  • +

Replies To: Certain Pseudo Classes Don't Stack?

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 3873
  • View blog
  • Posts: 11,408
  • Joined: 18-April 07

Re: Certain Pseudo Classes Don't Stack?

Posted 28 April 2011 - 04:02 PM

I believe this is in response to a vulnerability that arises when an attacker creates a web page which has style definitions detecting if a link has been visited (using :visited) to a known 3rd party site. Then within the style definition they reference an file on attackers site. This allows an attacker to monitor that file and know which sites a user has been to and can use that info to then exploit the user.

I don't think there is any real work around and if there was, it would open up the user again to such attackers.

I believe this is why they don't allow the stacking of anything that can mark or modify a visited link using another pseudo class.

:)
Was This Post Helpful? 0
  • +
  • -

#3 Calicode  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 26-July 08

Re: Certain Pseudo Classes Don't Stack?

Posted 28 April 2011 - 10:38 PM

I was beginning to figure as much, since most of the references to that I found were around 2007 and a lot of papers to that effect were published later. It sucks that, in the course of negating detection, the user agents don't allow us to still style them- you can change the text color but can't pick it up, so why not allow :before and :after? It seems a bit overboard, but I suppose greater minds than mine have thought on the matter.

Thank you for your response.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1