css | 使用background-blend-mode属性实现 上传图片背景遮罩样式

91 阅读1分钟

image.png

<n-el class="uploading">
    <n-icon color="#ffffff">
        <i-eos-icons:bubble-loading />
    </n-icon>
    <n-el class="text">上传中</n-el>
</n-el>
  .uploading {
    width: 160px;
    height: 90px;
    background-size: 100% 100%;
    border-radius: 4px;
    background-color: rgba(0, 0, 0, 0.5);
    background-blend-mode: multiply; // ✨✨✨
    background-image:url(xxxxxxx);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    .text {
      font-size: 12px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #ffffff;
    }
  }

注意:Internet Explorer 不支持 background-blend-mode 属性。

参考文档:

1、www.runoob.com/cssref/pr-b…

2、www.51sjk.com/b32b148233/