html - 将视频置于 DIV 中

标签 html css video

如何将此视频置于包含它的 DIV 中?

.courses-container {
display: table-cell;
width: 100%;
background-color: #00ffd0;
}

.courses-col{
float: left;
width: 50%;
}

@media only screen and (max-width: 500px) {
.courses-col {
float: left;
width: 100%;
}
}

center {
text-align: center;
}
<div class="courses-container">
<div class="courses-col">
<br>
<video class="center" width="80%" autoplay controls loop>
<source src="Video URL" type="video/mp4">
Your browser does not support the video tag.
</video>
<br><br>
</div>

<div class="courses-col">
<br>
<p>Text</p>
<br>
</div>
</div>

我只需要能够将显示在文本左侧的视频居中。鉴于它在 DIV 中,我该怎么做?

最佳答案

只需添加:

video.center {
margin: auto;
display: block;

关于html - 将视频置于 DIV 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49909735/

相关文章:

html - 跨单元干扰 td :nth-child(even) logic

internet-explorer - 如何在 IE 上使用 CSS3 边框半径和框阴影属性?

javascript - 查询 : How to disable mouse move vertically?

wpf - 如何知道我的 WPF 应用程序可以播放哪些视频格式?

javascript - 防止 HTML5 视频在移动设备上下载文件 - videojs

javascript - 更改上一页和下一页以进行分页,具有过滤功能

javascript - 独特的过滤器 ng-repeat Angular。隐藏列中而不是整行中的重复值

html - CSS 不对齐 Div 内的文本

css - 使用内联样式的不带小数点的上标字母

javascript - 悬停播放视频缩略图几秒钟,然后显示缩略图。 - Javascript