css - 为什么我不能让 HTML 视频标签顶部对齐?

标签 css html video alignment html-table

我的目标是让视频占据 1080p 屏幕顶部的 90%,留下底部的 10% 用于文本。

无论我尝试什么,视频似乎都不合适或对齐。

使用 html 视频标签是否有技巧?

 <table style="width:1080px;height:100%;background-color:#888">
  <tr valign="top">
    <td width="1080px" height="90%" valign="top">
<video width="1080px" height="100%" src="video.mp4" autoplay loop></video>
    </td>
  </tr>
    <tr>
    <td>TEXT</td>
  </tr>
</table>

例子:

https://jsfiddle.net/1u1xc1sL/

enter image description here

最佳答案

使用 CSS:

video {
  //how far from top
  top: 0px;
}
<video style="background-color: black;" width="1080px" height="100%" src="video.mp4" autoplay loop>Your bowser dooes not support the video tag</video>

关于css - 为什么我不能让 HTML 视频标签顶部对齐?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40985741/

相关文章:

javascript - 了解 Iframe 中的跨域问题

image - 在内存中渲染 MATLAB 图

css - 尝试使用 css 均匀分布图像

css - 为什么 chrome 会突出显示样式或计算中未列出的边距

javascript - 带有淡入的 Angular 2 SwitchCase

html - 两个不同的 div 以相同的样式显示,即使我为每个 div 指定了不同的颜色

html - 在 div 内垂直居中 div

html - webkit 浏览器不继承圆 Angular

html - 三星Smart TV App中的多种声音(音频和视频)

video - 无法使用任何工具旋转/转码视频