保留点击链接的样式

时间:2017-09-08 11:24:32

标签: html css

我有这个链接列表,他们使用php调用。如果点击它们页面刷新以加载链接的内容,但是我希望链接保持与(:hover)相同的样式。)

链接看起来像这样:

<a href="editfiles.php?file=pages/something.html">something.html</a>

它的css是:

a:hover{
    font-weight: 700;
    color: #039AD2;
}

a {
    color: #777;
    font-weight: 500;
}

我不确定我是如何实现这一目标的。

感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

你应该重新组织你的css:

a {
    color: #777;
    font-weight: 500;
}

a:visited,
a:hover,
a:active {
    font-weight: 700;
    color: #039AD2;
}

比已访问过的链接和当前活动的链接看起来像悬停的链接。

相关问题