在弹性盒中使用视频作为背景(多个部分必需的视频背景)
我有一个带有四个flex部分的Div。
四个部分中有两个需要将视频用作BG。
但是该视频似乎不允许使用父母的100%高度。
就这样。
我搜索了很多。
看来该视频不尊重父母的高度/宽度,而只是视频高度/宽度。
预期:
所有选择都是相同的大小,需要两个视频背景。
< body> < div id =“ a”> < div> < span> test</span> </div> < div> < span> test</span> </div> < div> <视频src =“ https://www.sample-videos.com/video123/mp4/720/big_buck_bunny_720p_1mb.mp4” < span> test</span> </div> < div> <视频src =“ https://www.sample-videos.com/video123/mp4/720/big_buck_bunny_720p_1mb.mp4” < span> test</span> </div> </div> </body>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一些修复程序:
视频
标签是不正确的,位置:相对
todiv
parent,以便使用父母使用视频。位置:绝对
z-index:-1
,它将可选地用作背景视频,您的
#A
背景(我更改为<<<<代码>部分),我猜你想要要将其添加到视频
要与测试对比的区域,请将其删除并将其添加到div :: after
之后A few fixes:
video
tag is not correctposition:relative
todiv
parent in order to video fit inside the parent usingposition:absolute
z-index:-1
so it will work as background videoOptionally, your
#a
background (which I changed tosection
), I'm guessing you want to add it to the areas wherevideo
are to make contrast with test, if so, then remove it and add it todiv::after