Animate background gradient transition | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Animate background gradient transition

Hello guys! I am having an inconvenience to perform the animation in a simple background gradient transition. Although the mouse passes over the object, the gradient transition is successful, but the time transition is automatic, despite being set to 20sec. Could someone give me a hand? div { width: 70px; height: 50px; background:-webkit-linear-gradient(right, red, green 30%); transition: background 20s; -webkit-transition: background 20s; } div:hover { background:-webkit-linear-gradient(right, red, green); } p { color: rgb(255,255,255,0.4); font-family: Calibri; display: inline-table; position: absolute; transform: translate(10px, 0px);

17th Jan 2020, 1:27 PM
Sebastián Toso
Sebastián Toso - avatar
2 Answers
+ 1
background not an animatable css property. More information please check https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_animated_properties
17th Jan 2020, 1:53 PM
Calviղ
Calviղ - avatar
0
thks!
17th Jan 2020, 9:32 PM
Sebastián Toso
Sebastián Toso - avatar