CSS animation-direction property

Use the animation-direction property to set whether an animation should be played forwards, backward or in alternate cycles.

You can try to run the following code to implement the animation-direction property:


Live Demo

<!DOCTYPE html>
         div {
            width: 150px;
            height: 200px;
            background-color: yellow;
            animation-name: myanim;
            animation-duration: 2s;
            animation-direction: reverse;
         @keyframes myanim {
            from {
               background-color: green;
            to {
               background-color: blue;