Overlay divs on scroll

前端 未结 3 432
日久生厌
日久生厌 2020-12-29 16:58

Instead of scrolling down the page to view a bunch of divs, I would like them to overlay in the same place-- one stacked on top the next -- when you scroll. So, you would sc

3条回答
  •  暖寄归人
    2020-12-29 17:29

    Use position fixed instead of absolute:

    .container1 {
        position: fixed;
        z-index: 1;
    }
    .container2 {
        position: fixed;
        z-index: 2;
    }
    

提交回复
热议问题