Everything You Need to Know About CSS Animation

CSS stands for cascading style sheet and it is used to design a website. HTML makes the website structure, but CSS is what is used to attract that design. In this tutorial, you will look into CSS Animations.

CSS Animation

The CSS animation property is used to create animations on a web page. You can change as many CSS properties as you want. And you can do this as many times as you want. 


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

Full Stack Web Developer Course

To become an expert in MEAN StackView Course
Full Stack Web Developer Course

CSS Animation Properties




It is used to specify the animations


It is a shorthand property that is used to set all the other properties


It sets when the animation will start


It specifies how long the animation should take to complete one cycle


It sets whether the animation should play in forward, backward, or alternate cycles 


It specifies how a CSS animation should apply styles to its target, before and after it is executing


This indicates if the animation is currently running or paused


It is used to mention the name of the @keyframes defined animations that should apply to the selected elements

CSS Animation Example 1



In this example, 0% is the beginning of the animation and 100% is the end.

Note: If the duration for the animation is not defined, it will fail to run, as the default value set for the duration is 0s.


Stand Out From Your Peers this Appraisal Season

Start Learning With Our FREE CoursesEnroll Now
Stand Out From Your Peers this Appraisal Season

CSS Animation Example 2


Here, the ease-out value is used to set the animation with a slow end.

The CSS animation-iteration-count property indicates  the no. of times the animation currency i use should play normally. The default value set for the CSS animation-iteration-count is 1.

The CSS animation-fill-mode property defines the element’s style when the animation isn’t active.


Get skilled in HTML5 and CSS3 with the Full Stack Java Developer Master's Program. Click to check out the program details! 


So in this CSS animation tutorial, you learned about several values of the animation property, and how you can use them to animate the elements on a web page. 

If  you want to enhance your knowledge of CSS and master its practical applications, Simplilearn's Postgraduate Program in Full Stack Web Development is one that you should definitely explore. This comprehensive bootcamp course is in collaboration with Caltech CTME, and will help you today’s most effective coding techniques and software development skills from the ground up - helping you gain all that you will need to become a successful, world-class full-stack technologist today..

If you have any feedback or questions for us on the CSS animation tutorial, do reach out to us by sharing them in the comments section you find at the bottom of this page. Our team of SMEs will review them, and share responses to them, very soon.

Happy learning!

About the Author

Aryan GuptaAryan Gupta

Aryan is a tech enthusiast who likes to stay updated about trending technologies of today. He is passionate about all things technology, a keen researcher, and writes to inspire. Aside from technology, he is an active football player and a keen enthusiast of the game.

View More
  • Disclaimer
  • PMP, PMI, PMBOK, CAPM, PgMP, PfMP, ACP, PBA, RMP, SP, and OPM3 are registered marks of the Project Management Institute, Inc.