首页 > 解决方案 > 在 Github Flavored Markdown 中水平居中表格

问题描述

我有一张用github 风格的 markdown写的表。它在 Github 自述文件中用于存储库。

我需要将表格水平居中,我尝试在几个标签(也有父标签)中定义对齐属性,但这似乎对对齐没有任何影响。

在此处输入图像描述

这是我使用的代码:

<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 是我保存在同一目录中的图像,也忽略了使用的 alt 名称。

标签: htmlcssmarkdowngithub-flavored-markdownreadme

解决方案


.center {
  margin-left: auto;
  margin-right: auto;
}
 <table class="center">
  <tr>
    <td><img src="https://via.placeholder.com/150"></td>
  </tr>
</table> 


推荐阅读