悬停不适用于背景图像线性渐变

时间:2020-10-30 06:14:01

标签: css

搜索答案并尝试一切。为什么悬停无法按书面要求工作:

a {
  font-size: 2rem;
  color: white;
  background-color: #018273;
  padding: 5px 10px;
  text-decoration: none;
  border-radius: 0.3rem;
  background-image: linear-gradient(to right, #018273 0%, #00f2fe 100%);
}
a:hover {
  background-image: (to right, #15d9e4 0%, #018273 100%);
}

1 个答案:

答案 0 :(得分:1)

我认为我尝试了并且已经很好地工作了,这是我尝试过的演示代码:

a {
  font-size: 2rem;
  color: white;
  background-color: #018273;
  padding: 5px 10px;
  text-decoration: none;
  border-radius: 0.3rem;
  background-image: linear-gradient(to right, #018273 0%, #00f2fe 100%);
}
a:hover {
  background-image: linear-gradient(to right, #15d9e4 0%, #018273 100%);
}
<a href="#">Test</a>