Oli Studholme explains in a post on his website that while background-image is not currently an animatable property, the CSS Working Group is working towards changing this in the future.
There are ongoing efforts within the group to address these issues, with transitioning background-image as one of the key focus areas for improvement.
On the other hand, background-color is indeed an animatable property and can be smoothly transitioned:
body {
background-color: #666;
height: 100%;
-moz-transition: background-color 1s ease;
}
@media screen and (max-width: 800px) {
body {
background-color: #ccc;
-moz-transition: background-color 1s ease;
}
}
@media screen and (max-width: 400px) {
body {
background-color: #fff;
-moz-transition: background-color 1s ease;
}
}
Although gradients do not change smoothly using CSS transitions, you can achieve a similar effect by altering the background color properties dynamically:
body {
background-image: -moz-linear-gradient(top, #369, #000);
height: 100%;
}
@media screen and (max-width: 800px) {
body {
background-image: -moz-linear-gradient(top, #036, #000);
}
}
@media screen and (max-width: 400px) {
body {
background: #000;
}
}
Ultimately, it's important to choose which properties to utilize based on the compatibility requirements of your target browsers.