Shorthand property สำหรับกำหนดคุณสมบัติแอนิเมชันทั้งหมดคือ animation ตั้งค่า animation duration, name, เป็นต้นในบรรทัดเดียว
ตัวอย่างโค้ด
ลองรันโค้ดด้านล่างเพื่อทำงานกับ animation shorthand property:
<!DOCTYPE html>
<html>
<head>
<style>
div {
width: 150px;
height: 200px;
background-color: yellow;
animation: myanim 2s;
}
@keyframes myanim {
from { background-color: green; }
to { background-color: blue; }
}
</style>
</head>
<body>
<div></div>
</body>
</html>
หมายเหตุ: บทความนี้มีเนื้อหาเหมือน ID 1004062774 (ซ้ำ) รูปแบบเต็ม: animation: name duration timing-function delay iteration-count direction fill-mode play-state;