【问题标题】:How do I display tables side by side [duplicate]如何并排显示表格[重复]
【发布时间】:2016-07-07 01:00:23
【问题描述】:

这是当前显示的样子:

这就是我想要的样子:

.d1{
  background:#F0F0F0;
  border: 1px solid #A4A4A4;
}


#designs input, #itemz input{
  height:19px;
  font-size: 15px;
}

#designs #fds_image {
  background-size: 190px 221px;
  height: 221px;
  width: 190px;
  overflow:hidden;
}

#designs #fds_image img{
  width: 190px;
}
<table id="designs" width="auto" align="center" border="0" bgcolor="#EBEBEB" cellspacing="5">
  <tbody>
    <tr>
      <td class="d1" name="item">
        <div id="fds_image">
          <button class="preview_switch">M</button>
        </div>
        <hr>
        <div class="bottom_bar">
          <button name="preview" data-original="m">Preview</button>
          <br>
          <tbody>
            <td class="d1" name="item">
              <div id="fds_image">
                <button class="preview_switch">M</button>
              </div>
        </div>
        <hr>
        <div class="bottom_bar">
          <button name="preview" data-original="m">Preview</button>

我尝试了很多事情并在网上进行了研究,但由于某种原因,它不起作用。我怎样才能让表格并排显示,就像我展示的那样?

【问题讨论】:

  • 分配显示:inline-block;到桌子上?
  • 还是一样的位置 :-(
  • 你的代码结构完全错误。我的意思不是谴责,但你有&lt;tbody&gt; 没有&lt;/tbody&gt;,你有另一个&lt;tbody&gt; 嵌套在一个&lt;div&gt; 嵌套在一个表格单元格内......但没有那个@987654329 的父表@ 要附加到...
  • 谢谢,我会解决的:D

标签: html css html-table


【解决方案1】:

您可以将默认的display: table 覆盖为inline-table

table {
  display: inline-table;
}

水平对齐多个&lt;table&gt; 元素的示例。

body {
  text-align: center;
}
table {
  width: 100px;
  height: 200px;
  border-collapse: collapse;
  display: inline-table;
}
td {
  border: 1px solid grey;
}
tr:first-child {
  height: 100%;
}
<table>
  <tbody>
    <tr>
      <td>Content</td>
    </tr>
    <tr>
      <td><button>Button</button></td>
    </tr>
  </tbody>
</table>

<table>
  <tbody>
    <tr>
      <td>Content</td>
    </tr>
    <tr>
      <td><button>Button</button></td>
    </tr>
  </tbody>
</table>

【讨论】:

【解决方案2】:

您可以尝试浮动表格。

table {
 float: left;
}

【讨论】:

    【解决方案3】:

    您可以制作一个更大的桌子,将您当前的两张桌子并排放置。

    <table style="margin: auto;">
    <tbody>
    <tr>
    <td><!-- Your first table --></td>
    <td><!-- Your second table --></td>
    </tr>
    </tbody>
    </table>
    

    【讨论】:

      猜你喜欢
      • 2018-02-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-25
      • 2012-04-17
      • 1970-01-01
      • 2010-11-05
      • 2018-03-30
      相关资源
      最近更新 更多