【发布时间】:2021-08-06 04:54:11
【问题描述】:
我想在不使用 CSS 的情况下将左侧的视频和右侧的图像在 html 中的同一行对齐
【问题讨论】:
-
您能否扩展一下“对齐”的含义 - 图像的底部和视频的底部在同一级别,或者顶部对齐或......?跨度>
我想在不使用 CSS 的情况下将左侧的视频和右侧的图像在 html 中的同一行对齐
【问题讨论】:
如果你不想使用 CSS,你可以试试 Bootstrap 4。它们有很好的 flex 行为:
<div class="d-flex flex-row">
<div class="p-2">Flex item 1</div> # elements on the left side
</div>
<div class="d-flex flex-row-reverse">
<div class="p-2">Flex item 1</div> # elements on the right side
</div>
【讨论】:
使用 HTML 表格:
<table>
<tr>
<td>
<video src="https://www.w3schools.com/html/movie.mp4" autoplay/>
</td>
<td>
<img src="https://www.gravatar.com/avatar/0fdacb141bca7fa57c392b5f03872176?s=48&d=identicon&r=PG&f=1">
</td>
</tr>
</table>
【讨论】:
只需使用包含一行和两个单元格的表格。您可以简单地使用 'width' 和 'height' 属性来修改其在页面中的大小。
<table width="100%" bgcolor="red" height="200px">
<tr>
<td bgcolor="green">
Your video goes here.
</td>
<td bgcolor="blue">
The image goes here.
</td>
</tr>
</table>
【讨论】: