<div class="two-kf-animation">2 Keyframes Animation</div>

<hr>

<div class="four-kf-animation">4 Keyframes Animation</div>
@keyframes change-bg-color-2kf {
  from {
    background-color: white;
  }
  to {
    background-color: darkviolet;
  }
}

.two-kf-animation {
  padding: 10px;
  margin: auto;
  border: 2px solid darkviolet;
  border-radius: 10px;
  font-family: "Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande",
    "Lucida Sans", Arial, sans-serif;

  color: darkviolet;
  width: 200px;

  animation-name: change-bg-color-2kf;
  animation-duration: 5s;
}

@keyframes change-bg-color-4kf {
  0% {
    background-color: white;
  }
  25% {
    background-color: bisque;
  }
  50% {
    background-color: crimson;
  }
  100% {
    background-color: darkviolet;
  }
}

.four-kf-animation {
  padding: 10px;
  margin: auto;
  border: 2px solid darkviolet;
  border-radius: 10px;
  font-family: "Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande",
    "Lucida Sans", Arial, sans-serif;

  color: darkviolet;
  width: 200px;

  animation-name: change-bg-color-4kf;
  animation-duration: 5s;
}
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.