Computer >> คอมพิวเตอร์ >  >> การเขียนโปรแกรม >> CSS

คุณสมบัติโหมดเติมภาพเคลื่อนไหว CSS


ใช้ โหมดเติมภาพเคลื่อนไหว คุณสมบัติเพื่อกำหนดสไตล์สำหรับองค์ประกอบเมื่อไม่ได้เล่นแอนิเมชั่น

คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อใช้งาน คุณสมบัติโหมดเติมภาพเคลื่อนไหว

ตัวอย่าง

<!DOCTYPE html>
<html>
   <head>
      <style>
         div {
            width: 150px;
            height: 200px;
            position: relative;
            background: red;
            animation-name: myanim;
            animation-duration: 2s;
            animation-fill-mode: backwards;
         }
         @keyframes myanim {
            from {left: 0px; background-color: green;}
            to {left: 200px; background-color: blue;}
         }
      </style>
   </head>
   <body>
      <div></div>
   </body>
</html>