Is a see-through child div possible?

后端 未结 5 2051
遥遥无期
遥遥无期 2020-12-03 21:45

The image is the grandparent div, the black translucent overlay is the parent div, and the cropped section is the child div. User will see the grandparent image and

5条回答
  •  死守一世寂寞
    2020-12-03 22:15

    Overlaying divs (Proof of Concept)

    .parent,
    .child {
      background-image: url(https://scontent-lht6-1.cdninstagram.com/vp/0f18c710d8dc3ebd48819b3f9f44b5cc/5C28EE7E/t51.2885-15/e35/29094825_1798384780455300_8914767740305145856_n.jpg?se=7&ig_cache_key=MTc0MDQ5MzIwMjE5OTYyODM5MQ%3D%3D.2);
      background-size: contain;
    }
    
    .parent {
      height: 1072px;
      width: 1072px;
      opacity: 0.3
    }
    
    .child {
      position: absolute;
      top: 150px;
      left: 20px;
      height: 200px;
      width:500px;
      background-position: -20px -150px; 
      background-size: 1072px 1072px
    }

提交回复
热议问题