CSS animation-name

The CSS animation-name property is used to define the name for an animation or @keyframes. For example:

HTML with CSS Code
<!DOCTYPE html>
      div#mydiv {width: 50px; height: 50px; border-radius: 50%;
         background-color: maroon; position: relative;
         animation-name: codescracker; animation-duration: 2s; animation-iteration-count: infinite;}
      @keyframes codescracker {
         from {background-color: crimson; top: 0px; left: 0px;}
         to {background-color: darkblue; top: 220px; left: 220px;}

   <div id="mydiv"></div>

Note - The animation-duration is used to define time to complete one iteration or cycle of an animation.

Note - The animation-iteration-count is used to define the total number of iterations or cycles for an animation to play.

Note - The @keyframes is used to define the change in styles for multiple times in one cycle of selected animation.

CSS animation-name Syntax

The syntax of animation-name property in CSS, is:

animation-name: x;

The value of x should be any of the following:

CSS Online Test

« Previous Tutorial Next Tutorial »

Liked this post? Share it!