Animate Smoothly Between Two Background Colors
CSS animations allow you to set up simple rules that the rendering engine can then apply to create smooth transitions between style states.
To smoothly transition between two background colors, we can create a keyframes at-rule with a fitting name (e.g. pulse
).
Over the course of a single animation, this set of rules will start the background color at red, transition to blue 50% of the way through, and then back to red again.
We can then apply this animation within any of our CSS class definitions.
Anything with a class of square1
will have a width and height of 100px
as well as a pulsing background color.
PreviousAdd Fab Icons To Your Site With FontAwesome 5NextApply Multiple Box Shadows To Single Element
Last updated