html中链接点击变颜色,刷新后颜色不恢复要怎么解决?

html中链接点击变颜色,刷新后颜色不恢复要怎么解决?
试了清除缓存,但是还是不行。

    <meta http-equiv="Expires" content="0">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-control" content="no-cache">
    <meta http-equiv="Cache" content="no-cache">

有没有什么办法可以解决的,新手求教。

你要刷新后颜色恢复,就不要用a:visited 设置已被访问过的链接的颜色
a:visited 设置成与a:link 一样的颜色
改成用js设置鼠标点击后链接颜色, 这样刷新后颜色就恢复了

你题目的解答代码如下:

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <title> 页面名称 </title>
<style type="text/css">
a:link {color: #00f;} /* 未被访问的链接 蓝色 */
a:visited {color: #00f;} /* 已被访问过的链接 蓝色 */
a.click {color: #f0f;} /* 鼠标点击后链接 紫色 */
a:hover {color: #f00;} /* 鼠标悬浮在上的链接 红色 */
a:active {color: #0f0;} /* 鼠标点中激活链接 绿色 */
</style>
<script type="text/javascript" src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).on("click", "a", function(event){
    $(this).addClass("click");
});
</script>
</head>
<body>
    <a href="#1" title="">aaaaaaaaa</a>
    <a href="#2" title="">bbbbbbbbb</a>
</body>
</html>

如有帮助,请点击我的回答下方的【采纳该答案】按钮帮忙采纳下,谢谢!

img

设置a标签样式,参考:

a:link {color: blue} /* 未被访问的链接 蓝色 */
a:visited {color: blue} /* 已被访问过的链接 蓝色 */
a:hover {color: blue} /* 鼠标悬浮在上的链接 蓝色 */
a:active {color: blue} /* 鼠标点中激活链接 蓝色 */

刷新后颜色不恢复,是不是你的颜色跟访问url做了处理

您好,我是有问必答小助手,您的问题已经有小伙伴帮您解答,感谢您对有问必答的支持与关注!
PS:问答VIP年卡 【限时加赠:IT技术图书免费领】,了解详情>>> https://vip.csdn.net/askvip?utm_source=1146287632