我是CSS的新手,试图了解如何根据状态更改来修改链接。在我的情况下,我想将链接更改text-decoration为“ line-through已访问”状态。但是,在Mozilla和Chrome浏览器上,当链接处于“ 访问”状态时,text-decoration文本内容都不会更新,如下所示。我哪里做错了?line-through
请注意,当链接状态更改为已访问但链接text-decoration保持不变时,颜色会更新(变为绿色)(请参阅演示1);
注意:Mozilla有关于同一问题的错误报告:Mozilla错误#645786和错误报告。tag.class:state 选择器(a.:visited)也会出现问题(请参阅演示#2)
<!DOCTYPE html>
<html>
<head>
<style>
a:link {
color: red;
text-decoration: none;
}
a:visited {
color: green;
text-decoration: line-through;
}
a:hover {
color: blue;
}
a:active {
color: yellow;
}
</style>
</head>
<body>
<p>
<b>
<a href="http://google.com" target="_blank">This is a link</a>
</b>
</p>
</body>
</html>Run Code Online (Sandbox Code Playgroud)
<!DOCTYPE html>
<html> …Run Code Online (Sandbox Code Playgroud)