table new line

zal wel 20 Reputation points
2026-03-20T11:40:20.51+00:00

i like to have two tables next to eachother and one on a new line, so

1 2

3

How?

<style>
  .divtag{     
table
{
float: left;
}
}
</style>
<div class="divtag">
<table >
    <tr>
      <td> 1 </td>
    </tr>
  </table  >
  <table >
    <tr>
      <td> 2 </td>
    </tr>
  </table>
</div>

<table>
    <tr>
      <td> 3 </td>
    </tr>
  </table>
Community Center | Not monitored

1 answer

Sort by: Most helpful
  1. AI answer

    2026-03-20T11:40:32.25+00:00

    Use CSS to float only the first two tables and clear the third one so it starts on a new line.

    Example:

    <style>
      .inline-table {
        float: left;
        margin-right: 10px; /* optional spacing */
      }
    
      .newline-table {
        clear: both; /* forces this table onto a new line */
      }
    </style>
    
    <table class="inline-table">
      <tr>
        <td>1</td>
      </tr>
    </table>
    
    <table class="inline-table">
      <tr>
        <td>2</td>
      </tr>
    </table>
    
    <table class="newline-table">
      <tr>
        <td>3</td>
      </tr>
    </table>
    

    Key points:

    • Apply float: left; to the first two tables so they sit next to each other.
    • Apply clear: both; to the third table so it starts below the floated ones.
    • Avoid putting the table { float:left; } rule inside another selector block as in the original CSS; that syntax is invalid in standard CSS.

    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.