Advertisement
Advertisement


HTML -- two tables side by side


Question

Possible Duplicate:
Trying to get tables next to each other horizontal

I have two html tables already created. How can I place them side by side instead of 1 above the other?

2017/05/23
1
39
5/23/2017 12:02:14 PM

Accepted Answer

Depending on your content and space, you can use floats or inline display:

<table style="display: inline-block;">

<table style="float: left;">

Check it out here: http://jsfiddle.net/SM769/

Documentation

2012/07/27
96
7/27/2012 3:01:51 PM

You can place your tables in a div and add style to your table "float: left"

<div>
  <table style="float: left">
    <tr>
      <td>..</td>
    </tr>
  </table>
  <table style="float: left">
    <tr>
      <td>..</td>
    </tr>
  </table>
</div>

or simply use css:

div>table {
  float: left
}
2012/07/27

<div style="float: left;margin-right:10px">
  <table>
    <tr>
      <td>..</td>
    </tr>
  </table>
</div>
<div style="float: left">
  <table>
    <tr>
      <td>..</td>
    </tr>
  </table>
</div>
2020/01/04

With CSS: table {float:left;}‚Äč ?

2012/07/27