48

可能重复:
试图让表格彼此水平相邻

我已经创建了两个 html 表。我怎样才能将它们并排放置而不是 1 在另一个之上?

4

4 回答 4

108

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-27T15:01:51.667 回答
14

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-27T14:57:09.933 回答
6
<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>
于 2012-07-27T14:59:53.263 回答
0
于 2012-07-27T14:54:34.657 回答