0

In HTML/CSS I need to make some text, default the color is white.

But on hover I need to make it fade into gradient color. I am using the next code:

CSS:

.a {
  font-family: Arial;
  font-size: 32px;
  font-weight: bold;
  background: -webkit-linear-gradient(white, white);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-transition: 2s; /* Safari */
  transition: 2s;
}
.a:hover {
  background: -webkit-linear-gradient(red, #eee);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-transition: 2s; /* Safari */
  transition: 2s;
}

HTML:

<div class="a">SOME TEXT</div>

But on hover the color is changed right away without transition. Any help on this?

Temani Afif
  • 245,468
  • 26
  • 309
  • 415
user3239349
  • 877
  • 1
  • 12
  • 33

0 Answers0