CSS Animations
Definition and Usage
Some CSS properties areanimatable, which means they can be used in animations and transitions.
Animatable properties can change gradually from one value to another, such as sizes, numbers, percentages, and colors.
Browser support
The numbers in the table indicate the first browser version that supports this method.
The -webkit-, -moz-, or -o- immediately following a number specifies the first browser version that supports that prefixed property.
| 4.0 -webkit- | 10.0 | 16.0 | ||
| 5.0 -moz- | 4.0 -webkit- | 15.0 -webkit- |
12.1
12.0 -o- |
Example
The background color changes gradually from red to blue:
@keyframes
mymove
{
from
{
background-color:
red
;
}
to
{
background-color:
blue
;
}
}
/*
Safari and Chrome:
*/
@-
webkit-keyframes
mymove
{
from
{
background-color:
red
;
}
to
{
background-color:
blue
;
}
}
Try it »
Animation properties
Animation properties in CSS: