CSS3 animation-name
Property
Topic: CSS3 Properties ReferencePrev|Next
Description
The animation-name
CSS property specifies the name of @keyframes
defined animations that should be applied to the selected element.
The following table summarizes the usages context and the version history of this property.
Default value: | none |
---|---|
Applies to: | All elements, ::before and ::after pseudo-elements |
Inherited: | No |
Animatable: | No. See animatable properties. |
Version: | New in CSS3 |
Syntax
The syntax of the property is given with:
The example below shows the animation-name
property in action.
.box {
width: 50px;
height: 50px;
background: red;
position: relative;
/* Chrome, Safari, Opera */
-webkit-animation-name: moveit;
-webkit-animation-duration: 2s;
/* Standard syntax */
animation-name: moveit;
animation-duration: 2s;
}
/* Chrome, Safari, Opera */
@-webkit-keyframes moveit {
from {left: 0;}
to {left: 50%;}
}
/* Standard syntax */
@keyframes moveit {
from {left: 0;}
to {left: 50%;}
}
Property Values
The following table describes the values of this property.
Value | Description |
---|---|
keyframe-name | Specifies the name of the keyframe you want to bind to the selector. |
none |
Specifies that there will be no animation. This can be used to override or deactivate any animations coming from the cascade. |
initial |
Sets this property to its default value. |
inherit |
If specified, the associated element takes the computed value of its parent element animation-name property. |
Browser Compatibility
The animation-name
property is supported in all major modern browsers.
Basic Support—
|
Further Reading
See tutorial on: CSS3 Animations.
Related properties and at-rules: animation
, animation-duration
, animation-timing-function
, animation-delay
, animation-iteration-count
, animation-direction
, animation-fill-mode
, animation-play-state
, @keyframes
.