How to show an animation that is hidden behind a colored div using a “reveal” div on the surface

后端 未结 5 771
遇见更好的自我
遇见更好的自我 2020-12-18 01:09

Imagine that we have two layers of background.

  • The bottom layer is green

    . For simplicity, let\'s assum
5条回答
  •  执笔经年
    2020-12-18 02:04

    Do you want to put the reveal div in this postion only, or show the green color from the bottom layer?

    for only the positon you can add realtive position in your blue div and absolute position in your reveal div with top and left values.

    .green {
        background-color: #159c82;
        width: 100vw;
        height: 100vh;
    }
    
    .blue {
        background-color: #1b4287;
        width: 100%;
        height: 100%;
    
        position: relative;
    }
    
    .reveal {
        position: absolute;
        top: 10px;
        left: 10px;
    
        width: 200px;
        height: 50px;
    }
    

提交回复
热议问题