Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html Youtube背景在<;车身>;_Html_Css_Video_Youtube - Fatal编程技术网

Html Youtube背景在<;车身>;

Html Youtube背景在<;车身>;,html,css,video,youtube,Html,Css,Video,Youtube,代码非常简单,它基本上是一个iframe:(此代码就在标记之后 <div style="position: fixed; z-index: -99; width: 100%; height: 100%"> <iframe frameborder="0" height="100%" width="100%" src="https://www.youtube.com/embed/MYVIDEOID?autoplay=1&amp;controls=0&amp;

代码非常简单,它基本上是一个iframe:(此代码就在
标记之后

<div style="position: fixed; z-index: -99; width: 100%; height: 100%">
    <iframe frameborder="0" height="100%" width="100%" src="https://www.youtube.com/embed/MYVIDEOID?autoplay=1&amp;controls=0&amp;loop=1&amp;rel=0&amp;showinfo=0&amp;autohide=1&amp;wmode=transparent&amp;hd=1"></iframe>
</div>

我遇到的唯一问题是,我的显示器很宽,当最大化时,浏览器侧面的边缘是黑色的(这意味着视频只能拉伸这么多)。它只能满足窗口大小为高度或宽度的100%

换句话说,如果重新调整到“手机/平板电脑”垂直位置,视频的宽度将为100%(仍为16:9),但上边框上方和下边框下方的所有内容都将是黑色/空白


如何使视频始终覆盖100%的背景?(如果宽度远大于16:9高宽比的高度,它仍然可以适当缩放,只是在“可查看”中缺少视频的顶部/底部)查看。同样。如果在移动模式下,视频的高度是设备/浏览器的100%,视频仍然是16:9,但无法看到视频的侧面)

我找到了这个资源来完成我需要完成的工作:

最好使用自己的MP4(或类似)上传资源