我有两个使用以下语法水平对齐的表:

<table width=100%>
  <tr>
    <td><table1 code goes here>
    </td>
    <td><table2 code goes here>
    </td>
  </tr>
</table>

这一切都很好,而且如果表具有相同数量的数据行,它们就会对齐。但是如果一个比另一个少,那么它们仍然在相同的位置对齐,但另一个表缩小了,所以它们看起来像:
header
data
data
data    header
data    data
data    data
data    data
data
data

有没有办法让它们从上到下对齐?

喜欢
header    header
data      data
data      data
data      data
data
data
data
data
data

我怎样才能解决这个问题?

最佳答案

您可以使用 valign = top

<table width=100%>
  <tr>
    <td valign="top"><table1 code goes here>
    </td>
    <td valign="top"><table2 code goes here>
    </td>
  </tr>
</table>

关于html - 水平对齐两个表格 HTML/CSS,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/25511475/

10-12 00:16
查看更多