I would like to prevent the lower div (which includes an image and a button) from overlapping with the division above it that contains text. So, when the button encounters this upper division, I want it to move down in a way that pushes the image beneath it if there is no available space. Refer to the GIF for a visual understanding.
My attempt to resolve this by putting both divisions on the same z-index failed to produce the desired outcome.
https://i.sstatic.net/8XyMQ.gif
<!-- HTML snippet removed for brevity -->