css实现透明模糊效果

作者: 恍若如梦hzpeng | 来源:发表于2019-12-16 11:01 被阅读0次
  • 先上效果图


    image.png

就是一般的活动弹框,背景透明+模糊,内容是图片

  • 代码
    html
<div class="event-box">
  <div class="root-inner">
    <div class="content">
      <img src="content.png" alt="">
    </div>
  </div>
</div>

css:

.box {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;

  .root-inner {
    position: absolute;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    backdrop-filter: blur(2px) brightness(50%);
    background-color: rgba(0, 0, 0, .1);
    .content {
      width: 100%;
      height: 100%;
      display: flex;
      justify-content: center;
      align-items: center;
      img {
        max-height: 80%;
      }
    }
  }
}

相关文章

网友评论

    本文标题:css实现透明模糊效果

    本文链接:https://www.haomeiwen.com/subject/gdvrnctx.html