HTML -- 并排的两个表格

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11690223/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 01:53:24  来源:igfitidea点击:

HTML -- two tables side by side

htmlhtml-table

提问by Matt Stokes

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?

我已经创建了两个 html 表。如何将它们并排放置而不是将 1 个放置在另一个上方?

回答by Chris Baker

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/

在这里查看:http: //jsfiddle.net/SM769/

Documentation

文档

回答by jay c.

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

您可以将您的表格放在一个 div 中并为您的表格添加样式“浮动:左”

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

or simply use css:

或者简单地使用css:

div>table {
  float: left
}

回答by themhz

<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>

回答by Julien Ch.

With CSS: table {float:left;}??

使用 CSS:table {float:left;}??