【CSS】视频文字特效

效果展示

index.html

html 复制代码
<!DOCTYPE html>
<html>
  <head>
    <title> Document </title>
    <link type="text/css" rel="styleSheet" href="index.css" />
  </head>
  <body>
    <div class="container">
      <video src="fire.mp4" autoplay muted loop></video>
      <div class="txt">少莫千华</div>
    </div>
  </body>
</html>

index.css

css 复制代码
.container{
  color: #000;
  font-size: 10em;
  font-weight: bold;
  font-family: '李旭科书法';
}
video{
  width: 100%;
}

.txt{
  visibility: visible;
  position: absolute;
  inset: 0;
  background: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  mix-blend-mode: screen;
}
  • inset: 0;等同于 `top: 0; right: 0; bottom: 0; left: 0;
  • display: flex;弹性盒
  • position:absolute;绝对定位
  • justify-content:center;水平居中
  • align-items: center;垂直居中
  • mix-blend-mode: screen;混合模式-与上一层(视频层进行混合)

fire.mp4

下载

李旭科书法

下载

相关推荐
PineappleCoder几秒前
为什么说发布 - 订阅是代码的 “万能胶水”?解耦逻辑全解析
前端·javascript·算法
我叫黑大帅5 分钟前
微信小程序分包:告别加载慢,像拆快递一样简单!
前端·微信小程序
今禾9 分钟前
深入解析HTTP协议:从OSI模型到HTTP/3.0的演进与实战优化
前端·http·面试
sure28210 分钟前
react native 编写一个歌词组件
前端·react native
言兴11 分钟前
面试题深度解析:localStorage、sessionStorage 与 Cookie —— 前端存储的三大基石
前端·javascript·面试
言兴11 分钟前
HTTP 各版本演进史:从文本传输到极致性能 —— 深度解析协议进化与工程实践
前端·javascript·面试
跟橙姐学代码12 分钟前
学Python像学做人:从基础语法到人生哲理的成长之路
前端·python
临期程序员13 分钟前
TypeError: crypto.getRandomValues is not a function
前端·vue.js
鹏多多.16 分钟前
flutter-使用device_info_plus获取手机设备信息完整指南
android·前端·flutter·ios·数据分析·前端框架
杨荧1 小时前
基于Python的电影评论数据分析系统 Python+Django+Vue.js
大数据·前端·vue.js·python