Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

CSS3 animation Property


Binding an animation to a <div> element, using the shorthand property:

div {
    -webkit-animation: mymove 5s infinite; /* Safari 4.0 - 8.0 */
    animation: mymove 5s infinite;


Definition and Usage

The animation property is a shorthand property for eight of the animation properties:

  • animation-name
  • animation-duration
  • animation-timing-function
  • animation-delay
  • animation-iteration-count
  • animation-direction
  • animation-fill-mode
  • animation-play-state

Note: Always specify the animation-duration property, otherwise the duration is 0, and will never be played.

CSS Syntax

animation: name duration timing-function delay iteration-count direction fill-mode play-state;

Property Values

Value Description
animation-name Specifies the name of the keyframe you want to bind to the selector
animation-duration Specifies how many seconds or milliseconds an animation takes to complete
animation-timing-function Specifies the speed curve of the animation
animation-delay Specifies a delay before the animation will start
animation-iteration-count Specifies how many times an animation should be played
animation-direction Specifies whether or not the animation should play in reverse on alternate cycles
animation-fill-mode Specifies what values are applied by the animation outside the time it is executing
animation-play-state Specifies whether the animation is running or paused
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit