Why doesn't this a:visited css style work?
Actually, this has nothing to do with case sensitivity. This is a security feature. The functionality of :visited
pseudoclass has been restricted in many modern browsers (Fx4, IE9, Chrome) to prevent CSS exploit: read about it here.
Nowadays, getComputedStyle()
in these browsers usually returns values for visited links as if they weren't visited. However, I can simply imagine circumventing of that: using font-weight
for visited links, the element's width changes so browsers that would allow changing font-weight
for :visited
links wouldn't actually fix the security hole.
Thus, there's no workaround for this issue.
As of 2020 one useful attribute that still works with :visited
is background-color
. So try:
:visited {background-color:red !important;}
:visited
also works on non a elements.
(Note: If its working, remove !important
. Bad practice. Using it here just to be quick.)