Search code examples
htmlalignmenthtml-table

How to put table under another table


how can I put one table under another if I have used align for example.

           center_table
left_table
           desired_table

But I am getting following result

           center_table
left_table desired_table

Here is my html code. center_table

    <table align="left">
        <tr>
            <td>left_table</td>
        </tr>
    </table>

    <table align="center">
        <tr>
            <td>desired_table</td>
        </tr>
    </table>

Without using css only HTML


Solution

  • Just add a <div style = "clear:both;"></div> in between your two tables. It should work then

    The clear property specifies which side(s) of an element other floating elements are not allowed.

    You can find more detail of it here http://www.w3schools.com/cssref/pr_class_clear.asp

    <table align="left">
      <table align="left">
        <tr>
            <td>left_table</td>
        </tr>
      </table>
      <div style="clear:both;"></div>
    
      <table align="center">
        <tr>
            <td>desired_table</td>
        </tr>
      </table>
    </table>
    

    or

     <table align="left">
        <tr>
            <td>left_table</td>
        </tr>
      </table>
    
      <div style="clear:both;"></div>
    
      <table align="center">
        <tr>
            <td>desired_table</td>
        </tr>
      </table>