CSS :visited 选择器的作用
cssweb developmentfront end technology更新于 2025/6/5 7:40:17
使用 CSS :visited 选择器为所有已访问的链接设置样式。
示例
您可以尝试运行以下代码来实现 :visited 选择器:
<!DOCTYPE html>
<html>
<head>
<style>
a:link, a:visited {
background-color: white;
color: black;
border: 1px solid blue;
padding: 30px 30px;
text-align: center;
text-decoration: none;
display: inline-block;
}
a:hover, a:active {
background-color: red;
color: white;
}
</style>
</head>
<body>
<a href = "demo.html" target = "_blank">Demo Link</a>
</body>
</html>
相关文章
有用资源
css 参考教程 - 该教程包含有关 css 的更多信息:https://www.cainiaomax.com/css/

