25 CSS Hacks Every Developer Should Know

Animated gradient background

Problem: creating an animated gradient background.

Solution: use `@keyframes`.

@keyframes gradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.animated-gradient {
  background: linear-gradient(270deg, #ff7e5f, #feb47b);
  background-size: 400% 400%;
  animation: gradient 15s ease infinite;
}