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

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


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

ในตัวอย่างด้านล่าง เราได้ตั้งค่าคุณสมบัติเป็นความกว้างและกำหนดระยะเวลาด้วย:

ตัวอย่าง

<!DOCTYPE html>
<html>
   <head>
      <style>
         div {
            width: 150px;
            height: 150px;
            background: blue;
            transition-property: width;
            transition-duration: 3s;
         }
         div:hover {
            width: 250px;
         }
      </style>
   </head>
   <body>
      <h1>Heading One</h1>
      <p>Hover over the below box to change its width.</p>
      <div></div>
   </body>
</html>