0

I have a table written in github flavored markdown. It is used in Github readme file for a repository.

I need to center the table horizontally, i tried to define align attribute in several tags (parented tags also), but that doesn't seems to take any effect on the alignment.

enter image description here

here's the code i used:

<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 is an image i kept in the same directory, also ignore the alt name used.

Billy
  • 1,157
  • 1
  • 9
  • 18
  • sorry but that doesn't have any effects on tables. Also mentioning, that i'm using github flavored markdown :) – Billy Feb 12 '21 at 17:01
  • 1
    Note that while the duplicate question [Is it possible to have a table in the center in Github gist markdown?](https://stackoverflow.com/questions/44172954/is-it-possible-to-have-a-table-in-the-center-in-github-gist-markdown) specifically mentions "gist" GitHub uses the same tools across all of their sites so the answer applies to GitHub.com as well. – Waylan Feb 12 '21 at 21:10

1 Answers1

1

.center {
  margin-left: auto;
  margin-right: auto;
}
 <table class="center">
  <tr>
    <td><img src="https://via.placeholder.com/150"></td>
  </tr>
</table> 
bklups
  • 300
  • 1
  • 13
  • thank you for answering, that works pretty well in markdown, but i'm using it in a github readme.md file (github flavored markdown), because of which it is showing a very different behavior in github – Billy Feb 12 '21 at 17:05