Perform Animation on CSS margin-top

CSSWeb DevelopmentFront End Technology

To implement animation on margin-top property with CSS, you can try to run the following code

Example

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <style>
         div {
            background-color: orange;
            animation: myanim 4s infinite;
            color: white;
         }
         @keyframes myanim {
            30% {
               margin-top: 30px;
            }
         }
      </style>
   </head>
   <body>
      <h2>Heading One</h2>
      <div>
         This is demo text.
      </div>
   </body>
</html>
raja
Published on 08-Jun-2018 10:27:45
Advertisements