Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Animate transform property with CSS Animation

With CSS, how can we perform animation on the transform property?


1 Answer
Nancy Den

To implement animation on transform property with CSS, you can try to run the following code:

Example

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <style>
         div {
            margin: auto;
            border: 2px solid blue;
            width: 300px;
            height: 400px;
            background-color: orange;
            animation: myanim 3s;
         }
         @keyframes myanim {
            30% {
               transform: rotate(120deg);
            }
         }
      </style>
   </head>
   <body>
      <h1></h1>
      <div>
         <h1>Demo</h1>
      </div>
   </body>
</html>
Advertisements

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.