You can animate z-index.

posted on

div {
  position: absolute;
  top: 0;
  left: 0;
  transition: z-index 2.5s;
}