W3Schools Tryit Editor

PHOTO EMBED

Tue Mar 14 2023 16:05:22 GMT+0000 (Coordinated Universal Time)

Saved by @Anzelmo #undefined

<!DOCTYPE html>
<html>
<head>
<style>
div {
  width: 100px;
  height: 100px;
  background-color: red;
  animation-name: example;
  animation-duration: 4s;
}
​
@keyframes example {
  0%   {background-color: red;}
  25%  {background-color: yellow;}
  50%  {background-color: blue;}
  100% {background-color: green;}
}
</style>
</head>
<body>
​
<h1>CSS Animation</h1>
​
<div></div>
​
<p><b>Note:</b> When an animation is finished, it goes back to its original style.</p>
​
</body>
</html>
​
​
content_copyCOPY

https://www.w3schools.com/css/tryit.asp?filename