Why Doesn't This CSS Style for :visited Links Work in Specific Browsers?
The following HTML and CSS code seems to exhibit an issue with styling visited links in Internet Explorer and Chrome:
<html> <head> <style> A {font-weight: bold; color:black;} A:visited {font-weight: normal; color: black; } .Empty {font-weight: bold; color: black; } </style> </head> <body> <a href="http://mysite">click me</a> </body> </html>
Despite applying the :visited pseudoclass, the clicked link remains bold instead of returning to normal weight. This behavior also occurs with Firefox 4, IE9, and Chrome.
Security Considerations and Workarounds
The functionality of the :visited pseudoclass has been restricted in modern browsers to prevent potential CSS exploits. These browsers implement specific measures to protect against such vulnerabilities:
Unfortunately, there is no workaround for this security measure in browsers that have implemented these restrictions. Changing the accessibility settings to ignore web colors, as mentioned in the original question, would not resolve the issue.
The above is the detailed content of Why Are My Styled Visited Links Not Working in Some Browsers?. For more information, please follow other related articles on the PHP Chinese website!