【发布时间】:2020-06-16 09:30:12
【问题描述】:
我正在尝试将 youtube 视频设置为 bredcrumb 背景,但我无法将视频宽度设置为全屏尺寸。正如您将看到的,视频下方的图像显示在 iframe 的中心,并且没有拉伸到全屏。
/视频左右两边的黑条/
这是我的代码:
#myVideo {
position: absolute;
right: 0;
top: 0;
bottom: 0;
width: 100vw; /*now it is 100% of viewport (window) width.*/
display: inline-block;
min-height: 100%;
z-index: -99;
}
<div id="myVideo" >
<iframe width="100%" height="300px;" src="https://www.youtube-nocookie.com/embed/eLZUlh1AwrM?loop=1&autoplay=1&playlist=eLZUlh1AwrM&disablekb=1&controls=0&fs=0&modestbranding=1&mute=1&showinfo=0&enablejsapi=1&widgetid=1" frameborder="0" allowfullscreen ></iframe>
</div>
【问题讨论】:
标签: html css video iframe embed