Set a Delay for the Start of an Animation with CSS



Use the animation-delay property to set a delay for the start of an animation with CSS:

Example

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <style>
         div {
            width: 150px;
            height: 200px;
            background-color: yellow;
            animation-name: myanim;
            animation-duration: 2s;
            animation-delay: 2s;
         }
         @keyframes myanim {
            from {
               background-color: green;
            }
            to {
               background-color: blue;
            }
         }
      </style>
   </head>
   <body>
      <div></div>
   </body>
</html>
Updated on: 2020-06-24T06:16:26+05:30

151 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements