1.通过video标签,引入视频文件
<video autoplay loop muted id="bgvid">
<source src="../../assets/background-video.mp4" type="video/mp4" />
</video>
2.复制下面的样式 ,即可使这个视频文件作为网页的背景
source {
min-width: 100%;
min-height: 100%;
height: auto;
width: auto;
}
video {
object-fit:cover;
position: fixed;
right: 0px;
bottom: 0px;
min-width: 100%;
max-height: 100%;
height: auto;
width: auto;
background-size: cover;
// background-image: url('../../assets/背景.jpg');
/*加滤镜*/
/* filter: blur(15px); //背景模糊设置 */
/*-webkit-filter: grayscale(100%);*/
/*filter:grayscale(100%); //背景灰度设置*/
z-index: -11;
}