You can animate z-index. div { position: absolute; top: 0; left: 0; transition: z-index 2.5s;} https://codepen.io/matuzo/pen/wvzRxKJ