【发布时间】:2014-10-26 13:38:07
【问题描述】:
我有以下html代码:
<a class="deletelink" onclick="return !deleteitem('delete.php')" href="delete.php"> Delete Item </a>
使用以下 css:
a.deletelink:hover,
a.deletelink:active {
background-color: #F00;
color:#FF0;
}
a.deletelink:visited,
a.deletelink:link {
line-height:5em;
width: 5em;
text-align: center;
margin:2em;
display: block;
font-weight: bold;
color:#F00;
background-color:#639;
padding: 0.5em;
text-decoration: none;
}
但是当鼠标移到链接上时链接的颜色不会改变。你能猜出这里有什么问题吗?
谢谢
【问题讨论】:
-
开发者始终会“访问”该链接,因此这些样式会覆盖早期的
:hover样式。 -
谢谢大家,按照您的建议更改悬停和链接的顺序解决了问题。