igorludi
igorludi

Reputation: 1581

How can one display tables side by side in Github Markdown?

For instance, this doesn't work, tables are joined:

| Tables   |      Are      |  Cool |             | Tables   |      Are      |  Cool |
|----------|:-------------:|------:|             |----------|:-------------:|------:|
| col 1 is |  left-aligned | $1600 |             | col 1 is |  left-aligned | $1600 |
| col 2 is |    centered   |   $12 |             | col 2 is |    centered   |   $12 |
| col 3 is | right-aligned |    $1 |             

Upvotes: 29

Views: 24155

Answers (2)

spacepickle
spacepickle

Reputation: 2778

Space between text marks the beginning and end of particular types of content. Try this:

<table>
<tr><th>Table 1 Heading 1 </th><th>Table 1 Heading 2</th></tr>
<tr><td>

|Table 1| Middle | Table 2|
|--|--|--|
|a| not b|and c |

</td><td>

|b|1|2|3| 
|--|--|--|--|
|a|s|d|f|

</td></tr> </table>

It will look like this:

two merkdown tables in one html table

Upvotes: 53

Jagrut
Jagrut

Reputation: 922

For GitHub, you can use the below format for displaying two tables side by side. This is the way I usually do it:

|Table 1|Table 2|
|--|--|
|<table> <tr><th>Table 1 Heading 1</th><th>Table 1 Heading 2</th></tr><tr><td>Row 1 Column 1</td><td>Row 1 Column 2</td></tr> </table>| <table> <tr><th>Table 2 Heading 1</th><th>Table 2 Heading 2</th></tr><tr><td>Row 1 Column 1</td><td>Row 1 Column 2</td></tr> </table>|

You can see the output here.

Note: Please do not use new line or it will not work.

Upvotes: 9

Related Questions