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

การใช้คุณสมบัติการหน่วงเวลาการเปลี่ยน CSS


ใช้ หน่วงเวลาการเปลี่ยน คุณสมบัติเพื่อชะลอเอฟเฟกต์การเปลี่ยนแปลงด้วย CSS คุณสามารถลองเรียกใช้รหัสต่อไปนี้เพื่อตั้งค่าการหน่วงเวลาการเปลี่ยน 1 วินาที

ตัวอย่าง

<!DOCTYPE html>
<html>
   <head>
      <style>
         div {
            width: 150px;
            height: 150px;
            background: blue;
            transition: width 3s;
            transition-delay: 1s;
         }
         div:hover {
            width: 250px;
         }
      </style>
   </head>
   <body>
      <h1>Heading One</h1>
      <p>Hover over the below box to change its width. It begins with a delay of 1 second.</p>
      <div></div>
   </body>
</html>