Can you overlay a transparent div on an image

前端 未结 4 820
眼角桃花
眼角桃花 2020-12-23 09:26

I ran accross this example in the image below that is done in Flash and I was wondering if a similar affect of having a transparent box at the bottom of an image with text o

4条回答
  •  悲哀的现实
    2020-12-23 09:54

    You can simply create an overlay by CSS only over any image.

    .container{
      width:250px; height:250px;
    }
    .container img{width:100%;height:100%}
    .container::before{
      content:'';
      position:absolute;
      left:0;
      top:0;
      background:#fff;
      z-index:9999;
      width:100%;
      height:100%;
      opacity:0;
    }

提交回复
热议问题