Prev Demo
Animation Duration
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title></title> <style> div { width: 100px; height: 100px; background: red; position: relative; /* For chrome and safari*/ -webkit-animation: animate 2s infinite; -webkit-animation-duration: 1s; /* For firefox*/ -moz-animation: animate 2s infinite; -moz-animation-duration: 1s; /*for opera */ -o-animation: animate 2s infinite; -o-animation-duration: 1s; /* standard syntax */ animation: animate 2s infinite; animation-duration: 1s; } @-webkit-keyframes animate { 0% { background: green; left: 0px; top: 0px; } 50% { background: pink; left: 200px; top: 200px; } 100% { background: blue; left: 0px; top: 0px; } } @-moz-keyframes animate { 0% { background: green; left: 0px; top: 0px; } 50% { background: pink; left: 200px; top: 200px; } 100% { background: blue; left: 0px; top: 0px; } } @-o-keyframes animate { 0% { background: green; left: 0px; top: 0px; } 50% { background: pink; left: 200px; top: 200px; } 100% { background: blue; left: 0px; top: 0px; } } @keyframes animate { 0% { background: green; left: 0px; top: 0px; } 50% { background: pink; left: 200px; top: 200px; } 100% { background: blue; left: 0px; top: 0px; } } </style> </head> <body> <h2>Animation duration</h2> <div></div> </body> </html>
Note: We DO NOT save your trial code in our database.
Output