我正在尝试在CSS中为锚标签编写伪代码,即链接(link),访问过的(visited),悬停(hover)和激活(active)。HTML代码如下:
<a href="https://www.w3schools.com/html/" target="_blank">
w3school
</a>
而CSS代码如下:
a:link {
color: blue;
text-decoration: overline underline;
}
a:visited {
color: green;
text-decoration: line-through;
}
a:hover {
color: red;
text-decoration: underline;
}
a:active {
color: black;
text-decoration: overline;
}
访问后,文本颜色变为绿色是正确的。然而,文本装饰是上划线和下划线,而不是穿过线::visited is partially working。看起来颜色被级联了,而文本装饰没有。有人能解释一下吗?