Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS gradient animation

I have a button (anchor) that has a CSS3 gradient on it.
I want to animate/fade the gradient to one color when the user hovers over the button.
The problem is I can't find how to do this- since jQuery UI animation on colors works only on regular ones, not gradients.
Any ideas?
Thanks!

like image 962
amitairos Avatar asked Jul 05 '11 10:07

amitairos


People also ask

Can you animate CSS gradients?

Thanks to the new @property defined in the CSS Properties and Values API Level 1 specification we can now have transition with custom properties (aka CSS variables).

How do you make an animated gradient background in CSS?

We can do this by using background size property and set it to 600%. the more color you have the more you will need to increase the number. And next create the animation to move the background position so it appears that the gradient is slowly transforming color.

How many types of gradient are there in CSS?

You can choose between three types of gradients: linear (created with the linear-gradient() function), radial (created with the radial-gradient() function), and conic (created with the conic-gradient() function).


1 Answers

You could use a CSS3 animation, although they aren't supported on all browsers. This page has an example of changing the background colour, obviously you'd need to add the gradient.

http://css3.bradshawenterprises.com/animations/

like image 185
DoctorMick Avatar answered Oct 19 '22 22:10

DoctorMick