Crossfade Background Images

A CSS-only solution for crossfading background images

Here’s the code for the 3-image setup:

.bg-fade-wrapper {
	position: relative;
	overflow: hidden;

	position: absolute; 
	width: 100%;
	height: 100%; 
        inset: 0;
	background-size: cover; 
	background-position: center center;
	opacity: 0;
	animation-name: fade-zoom;
	animation-duration: 18s;
	animation-iteration-count: infinite;

	animation-delay: 0s;

        animation-delay: 6s;

	animation-delay: 12s;

@keyframes fade-zoom {
	0% {
	transform: scale(100%);
	16.66% {
	33.33% {
	48.66% {
	100% {
	transform: scale(110%);

/* Use this if you want to pause the animation on hover */ 
.bg-fade-wrapper:hover .bg-fade{
	animation-play-state: paused;

Kyle Van Deusen

Co-founder of The Admin Bar Community, owner of OGAL Web Design, and a GeneratePress & GenerateBlocks enthusiast.

For official support, please visit the forums for GeneratePress or GenerateBlocks

If you're looking to have a website built with GeneratePress & GenerateBlocks, then visit my agency website.

1 thought on “Crossfade Background Images”

  1. Hi Kyle,

    I am new to CSS and web design. I followed your tutorial and used the code above. My problem is MOBILE. How to I make it mobile-responsive.

    How do I do this?



Leave a Comment