Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML how to align two tables in one row?

How to align two tables in one row, in the middle of the page? The results that I want to see:

                                11 12   11 12
                                21 22   21 22

The result that I get:

11 12
21 22
11 12
21 22
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>11</td>
    <td>12</td>
  </tr>
  <tr>
    <td>21</td>
    <td>22</td>
  </tr>
</table>
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>11</td>
    <td>12</td>
  </tr>
  <tr>
    <td>21</td>
    <td>22</td>
  </tr>
</table>
like image 813
user1942505 Avatar asked Oct 21 '22 20:10

user1942505


1 Answers

Please use this, adjust the width as per the requirement and if you want to place at the center of the document the take a div and align it center of the page and place the following html in it.

<table border="0" cellpadding="0" cellspacing="0" style="width:50%;float:left">
<tbody>
<tr>
  <td> 11</td>
  <td> 12</td>
</tr>
<tr>
  <td> 21</td>
  <td> 22</td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="0" cellspacing="0" style="width:50%;float:left">
<tbody>
 <tr>
  <td> 11</td>
  <td> 12</td>
</tr>
<tr>
  <td> 21</td>
  <td> 22</td>
</tr>
</tbody>
</table>
like image 143
user1954395 Avatar answered Nov 01 '22 16:11

user1954395