CSS Property animation-name








The animation-name property sets the name of @keyframes.

Summary

Initial value
none
Inherited
no
CSS Version
CSS3
JavaScript syntax
object.style.animationName="myAnimation"
Animatable
no

CSS Syntax

animation-name: keyframename|none;

Property Values

keyframename
set the name of the keyframe
none(Default value)
no animation

Browser compatibility

animation-name 4.0 -webkit- 10.0 16.0 (5.0 -moz-) 4.0 -webkit- 15.0 -webkit- (12.0 -o-)

Example

<!DOCTYPE html>
<html>
<head>
<style> 
div {<!-- ww  w. j ava  2s .  c o  m-->
    width: 100px;
    height: 100px;
    background: black;
    position: relative;
    -webkit-animation-name: mymove;  /* Chrome, Safari, Opera */
    -webkit-animation-duration: 5s;  /* Chrome, Safari, Opera */
    animation-name: mymove;
    animation-duration: 5s;
}

/* Chrome, Safari, Opera */
@-webkit-keyframes mymove {
    from {left: 0px;}
    to {left: 200px;}
}

@keyframes mymove {
    from {left: 0px;}
    to {left: 200px;}
}
</style>
</head>
<body>
    <div></div>
</body>
</html>

Click to view the demo