问题描述
我有一个用 github flavored markdown 编写的表格。它在 Github 自述文件中用于存储库。
我需要将表格水平居中,我尝试在几个标签(也有父标签)中定义 align 属性,但这似乎对对齐没有任何影响。
这是我使用的代码:
<h1 align="center">
<br>
<table align="center">
<tr><td>
<img src="./res/logo_static.png" width="200" alt="Pastemyst.Pas">
</td></tr>
</table>
</h1>
logo_static 是我保存在同一目录中的图像,也忽略使用的替代名称。
解决方法
.center {
margin-left: auto;
margin-right: auto;
}
<table class="center">
<tr>
<td><img src="https://via.placeholder.com/150"></td>
</tr>
</table>