CSS已访问,悬停和活动中的CSS无法正常工作

时间:2018-11-08 18:01:25

标签: css

  a: link {
        color: #000099;
        text-decoration: none;
    }

  a: visited {
        color: #000099;
        text-decoration: none;
    }

a: hover{
    color: #33cccc;
    text-decoration: underline;
}

a: active{
    color: #000099;
    text-decoration: underline;
}

我在CSS中使用了上面的代码,但是只有a:link在起作用,而其余的则没有。

我已经将其正确链接到我的html文件。

我使用的是崇高文字3。

1 个答案:

答案 0 :(得分:2)

您需要删除冒号后的空格。伪类始终附加在元素/类/ id上,没有空格。

a:link {
	color: #000099;
	text-decoration: none;
}

a:visited {
	color: #000099;
	text-decoration: none;
}

a:hover {
	color: #33cccc;
	text-decoration: underline;
}

a:active {
	color: #000099;
	text-decoration: underline;
}
<a href="#">Test</a>

相关问题