Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

CSS Animations

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:

property Example
background Try it yourself »
background-color Try it yourself »
background-position Try it yourself »
background-size Try it yourself »
border Try it yourself »
border-bottom Try it yourself »
border-bottom-color Try it yourself »
border-bottom-left-radius Try it yourself »
border-bottom-right-radius Try it yourself »
border-bottom-width Try it yourself »
border-color Try it yourself »
border-left Try it yourself »
border-left-color Try it yourself »
border-left-width Try it yourself »
border-right Try it yourself »
border-right-color Try it yourself »
border-right-width Try it yourself »
border-spacing Try it yourself »
border-top Try it yourself »
border-top-color Try it yourself »
border-top-left-radius Try it yourself »
border-top-right-radius Try it yourself »
border-top-width Try it yourself »
bottom Try it yourself »
box-shadow Try it yourself »
clip Try it yourself »
color Try it yourself »
column-count Try it yourself »
column-gap Try it yourself »
column-rule Try it yourself »
column-rule-color Try it yourself »
column-rule-width Try it yourself »
column-width Try it yourself »
columns Try it yourself »
filter Try it yourself »
flex  
flex-basis Try it yourself »
flex-grow Try it yourself »
flex-shrink Try it yourself »
font Try it yourself »
font-size Try it yourself »
font-size-adjust  
font-stretch  
font-weight Try it yourself »
height Try it yourself »
left Try it yourself »
letter-spacing Try it yourself »
line-height Try it yourself »
margin Try it yourself »
margin-bottom Try it yourself »
margin-left Try it yourself »
margin-right Try it yourself »
margin-top Try it yourself »
max-height Try it yourself »
max-width Try it yourself »
min-height Try it yourself »
min-width Try it yourself »
opacity Try it yourself »
order Try it yourself »
outline Try it yourself »
outline-color Try it yourself »
outline-offset Try it yourself »
outline-width Try it yourself »
padding Try it yourself »
padding-bottom Try it yourself »
padding-left Try it yourself »
padding-right Try it yourself »
padding-top Try it yourself »
perspective Try it yourself »
perspective-origin Try it yourself »
right Try it yourself »
text-decoration-color Try it yourself »
text-indent Try it yourself »
text-shadow Try it yourself »
top Try it yourself »
transform Try it yourself »
transform-origin Try it yourself »
vertical-align Try it yourself »
visibility  
width Try it yourself »
word-spacing Try it yourself »
z-index Try it yourself »