Animated backgrounds are a great way to add dynamics to your website without overloading performance. In this example, you will learn how to create fluid gradient animations and interactive effects using pure CSS.
@keyframes gradientAnimation the background moves (in animation) by changing
background-positionbackground-size: 200% 200%; animation: gradientAnimation 10s ease infinite;
border-radius),
with shadows (box-shadow)
@keyframes shadowChange {
0% {box-shadow: ... rgba(135, 206, 250, 0.5);} /* Blue shadow */
25% {box-shadow: ... rgba(255, 255, 150, 0.5);} /* Yellow shadow */
50% {box-shadow: ... rgba(255, 165, 0, 0.5);} /* Orange shadow */
75% {box-shadow: ... rgba(153, 101, 255, 0.5);} /* Purple shadow */
100% {box-shadow: ... rgba(135, 206, 250, 0.5);} /* Back to blue */
}
html and body use a base gradient, without additional elements yet