Animate CSS margin-left property

CSSWeb DevelopmentFront End Technology

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

Example

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <style>
         div {
            background-color: gray;
            animation: myanim 3s infinite;
            color: white;
         }
         @keyframes myanim {
            30% {
               margin-left: 20px;
            }
         }
      </style>
   </head>
   <body>
      <h2>Heading One</h2>
      <div>
         This is demo text.
      </div>
   </body>
</html>
raja
Published on 07-Jun-2018 12:41:55
Advertisements