.image-container { display: flex; height: 400px; justify-content: center; /* Horizontally center the images */ align-items: center; /* Vertically center the images */ } .image-container img { margin: 2vw; height: auto; max-width: 100%; } .overlay { position: absolute; z-index: 2; width: 200%; height: 400px; background-image: url('images/grid2.png'); background-repeat: repeat; animation: leftRight 90s linear infinite; } .hidden { position: absolute; z-index: 3; width: 14in; height: 400px; border-left: 100vw solid white; border-right: 100vw solid white; background-color: transparent; } @keyframes leftRight { 0% { left: 0; } 100% { left: -100%; } } header { margin-top: 35px; margin-bottom: 35px; }