【发布时间】:2017-05-03 17:31:12
【问题描述】:
我的 HTML 背景视频有问题。 我在 Stack Overflow 上找到了一些文章,并将其添加到我的 HTML 和 CSS 中。 但它似乎不起作用,它要么无法响应,要么与我的其他 div 和元素混淆。
这里是代码:
.container {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
height: 100%;
overflow: hidden;
box-shadow: 0px 10px 24px 0px rgba(50, 50, 75, 0.49);
font-size: 0;
background-color: yellow;
margin: auto;
z-index: -1000;
}
.container video {
min-width: 100%;
min-height: 100%;
width: auto;
position: absolute;
height: auto;
max-height: 100%;
width: 100%;
}
如您所见,视频宽度不会根据屏幕尺寸进行调整。我试过object-fit,但这会使其没有响应。
【问题讨论】:
标签: html css video background responsive