+
80
-

css如何实现文字内填充video视频?

css如何实现文字内填充video视频?


网友回复

+
0
-

可通过mix-blend-mode: screen来实现,效果如下:

800_auto

完整代码如下:

<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum=1.0,minimum=1.0,user-scalable=0" />

    <style>
        .box{
          width: 700px;
          height: 500px;
          position: relative;
        }
        video,
        i {
          width: 100%;
          height: 100%;
          position: absolute;
          top: 0;
          left: 0;
        }
        i{
          display: block;
        
          font-size: 200px;
          font-weight: 700;
          line-height: 500px;
          text-align: center;
          background: white;
          mix-blend-mode: screen;
        }
    </style>
</head>

<body>

    <div class="box">
        <video autoplay muted loop preload>
          <source src="//repo.bfw.wiki/bfwrepo/video/62269e88bd1f1.mp4" />
      </video>
        <i>BFW</i>
    </div>

</body>

</html>

我知道答案,我要回答