css链接访问背景

标签 css hyperlink background visited

由于某种原因访问背景没有变化为灰色。 有人知道如何修复吗?

a:link {
  height: auto;
  display: inline-block;
  border-radius: 5px;
  background: rgb(241,231,103);
  background: linear-gradient(to bottom, rgb(241,231,103) 0%, rgb(241,231,103) 32%, rgb(248,217,54) 73%, rgb(253,208,22) 100%);
}

a:visited {
  background-color: gray;
}

a:hover {
  background: linear-gradient(to bottom, rgb(253,208,22) 0%, rgb(248,217,54) 27%, rgb(241,231,103) 68%, rgb(241,231,103) 100%);
}

HTML 文件,我需要在我的任务中使用 css

<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>

<a href="http://www.stackoverflow.com">one</a>
<a href="#">two</a>
<a href="#">three</a>
<a href="#">seven</a>

</body>

最佳答案

尝试为您的链接设置默认背景颜色,例如 white

a{
  background-color: white;
}

然后

a:visited {
  background-color: gray;
}

关于css链接访问背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33944279/

相关文章:

html - 在 UL 中水平居中导航的问题

ios守护进程背景

html - 在 nav 元素内垂直对齐 div

javascript - 选择导致 CSS 元素改变颜色的 HTML 链接?

python - 将超链接添加到由 pandas dataframe to_excel 方法创建的 excel 表

javascript - 网址栏 id=1 转成 jQuery ID

css - 在 ul 列表中使用 sprite 图像?

ios - 无需 NSTimer,每分钟在后台保存位置

css - 防止使用 .htaccess 访问字体

javascript - 我想用 javascript 将链接延迟 500