HTML5 视频定位到顶部
有谁知道如何将视频内容定位到顶部,例如带有背景图像的“位置:顶部”?
我有一个 1920x1080px 的视频,但 div 当前使用 1920x550px。我尝试搜索万维网,但没有成功。
<video playsinline autoplay muted loop>
<source src="vid/vid_3.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
亲切地,
路易斯
Does anyone know how to position the video content to the top, like "position: top" with background images?
I have a video that is 1920x1080px, but the div is currently using 1920x550px. I have tried to search the World Wide Web without any luck.
<video playsinline autoplay muted loop>
<source src="vid/vid_3.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
Kindly,
Louis
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
感谢您的回复。不幸的是它不起作用,但我设法通过设置高度来修复它:
Thanks for the reply. Unfortunately it didn't work, but I've managed to fix it by setting the height:
我的示例将视频图片位置移动到页面顶部。
视频图片位于顶部并不明显,因为导航栏会遮挡它的视图。因此,在 navbar (是
设置示例:
然后找到
class="col-12 video-wrapper"
的 div 并添加到其"style"
...尝试如下设置:
My example moves the video picture position to the top of page.
It won't be obvious that the video picture is at top since the navbar will block the view of it. So in navbar (is
<nav id="navbar" ... >
setup code), to move it down for testing, add this to the tag setup:example setup:
Then find the div with
class="col-12 video-wrapper"
and add to its"style"
...try a setup like this:
我遇到了同样的问题,发现将视频 CSS 高度设置为“自动”对我有用。
以下是编辑 HTML 代码第一行以包含内联 CSS 的示例:
I encountered the same issue and found that setting the video CSS height to "auto" worked for me.
Here is an example of editing the first line of your HTML code to include inline CSS: