【转载】利用css将视频作为背景图片

转自:https://blog.csdn.net/zhh_5/article/details/126519567

<div class="videocontainer">
    <video class="fullscreenvideo" poster="__ROOT__/Themes/tdt/Asset/images/loginbg.jpg" id="bgvid" playsinline="" autoplay="" muted="" loop="">
        <source src="视频路径" type="video/mp4">
    </video>
</div>
.fullscreenvideo {

            position: absolute;

            width: 100%;

            height:100%;

        }

        .videocontainer {

            position: fixed;

            width: 100%;

            height: 100%;

            overflow: hidden;

            z-index: -100;

        }

        .videocontainer:before {

            content: "";

            position: absolute;

            width: 100%;

            height: 100%;

            display: block;

            z-index: -1;

            top: 0;

            left: 0;

        }
点赞

发表回复

电子邮件地址不会被公开。必填项已用 * 标注