You can animate z-index. posted on 17.12.2020 div { position: absolute; top: 0; left: 0; transition: z-index 2.5s; }