gpt4 book ai didi

html - 无法将视频添加为背景

转载 作者:行者123 更新时间:2023-12-04 07:20:49 27 4
gpt4 key购买 nike

我在网上环顾四周并尝试了两种不同的方法,但是,两种方法似乎都不起作用。
我需要让视频覆盖整个网页背景(我已经这样做了)-
css -

video#bgvid {
position: fixed;
top: 50%;
left: 50%;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
z-index: -100;
-ms-transform: translateX(-50%) translateY(-50%);
-moz-transform: translateX(-50%) translateY(-50%);
-webkit-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
background: url(polina.jpg) no-repeat;
background-size: cover;
}
HTML -
  <video playsinline autoplay muted loop poster="img/videoframe.jpg" id="bgvid">
<source src="https://streamable.com/kuuap9" type="video/mp4">
</video>
但是,这不会将任何内容加载到我的网站背景中……我在这里遗漏了什么/是否有更简单的解决方案?
我试过的另一种方法是,没有运气是 -
CSS-
.fullscreen-bg {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
overflow: hidden;
z-index: -100;
}

.fullscreen-bg__video {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
HTML-
<div class="fullscreen-bg">
<video playsinline autoplay muted loop poster="img/videoframe.jpg" id="bgvid">
<source src="https://streamable.com/kuuap9" type="video/mp4">
</video>
</div>
在此先感谢各位,任何帮助将不胜感激。

最佳答案

只是你需要下载文件或 url 有 .mp4

#bgvid {
width:100%;
hight:100vh;
position: absulote;
z-index:-1;


}

关于html - 无法将视频添加为背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68516617/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com