Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Run Animation backward first and then forwards with CSS
Use the animation-direction property to run animation in first backward and then forward. The property is used with the alternate-reverse animation value to achieve this.
Example
<!DOCTYPE html>
<html>
<head>
<style>
div {
width: 150px;
height: 200px;
position: relative;
background-color: yellow;
animation-name: myanim;
animation-duration: 2s;
animation-direction: alternate-reverse;
animation-iteration-count: 3;
}
@keyframes myanim {
0% {background-color:green; left:0px; top:0px;}
50% {background-color:maroon; left:100px; top:100px;}
100% {background-color:gray; left:0px; top:0px;}
}
</style>
</head>
<body>
<div></div>
</body>
</html>Advertisements