我有这个链接列表,它们是使用 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;
}
我不确定如何才能实现这一目标。
谢谢你的帮助。
最佳答案
你应该像这样重新组织你的 css:
a {
color: #777;
font-weight: 500;
}
a:visited,
a:hover,
a:active {
font-weight: 700;
color: #039AD2;
}
比已经访问过的链接和当前事件的链接看起来像悬停的链接。
关于html - 保留点击链接的样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46115390/